Set demand independent of how shifts are structured. This will force to assign employees in those shifts that minimize the gaps between supply and demand: by adjusting over- and under-supply.

demand
{
  "employees": [
    {
      "name": "John"
    }
  ],
  "shifts": [
    {
      "name": "S1",
      "from": "2022-01-01T12:00:00",
      "to": "2022-01-01T17:00:00",
      "min": 0,
      "max": 1
    }
  ],
  "demands": [
    {
      "name": "Special task",
      "from": "2022-01-01T14:00:00",
      "to": "2022-01-01T18:00:00",
      "min": 1,
      "max": 1
    }
  ]
}