Why are my script parameters getting wrapped in a list?

I’m trying to set up a script that takes a list of entities that it will apply an effect on. For some reason, however, when I enter multiple entries, they somehow get wrapped into an additional list, resulting in the parameter being a list of lists.

Can someone help me find out what I’m doing wrong?

Here is the script:

service: light.turn_on
data:
  brightness: '{{ (range(100,250)|random)|int }}'
  color_temp: '{{ (range(400, 500)|random)|int}}'
  transition: '{{ (range(800, 1500)|random)/1000 }}'
target:
  area_id: '{{areas|default([])}}'
  entity_id: '{{entities|default([])}}'

Here is how I’m calling it:

service: script.1684512264427
data:
  areas:
    - daniel_s_office
    - corridor

And here is the result:

  domain: light
  service: turn_on
  service_data:
    brightness: 108
    color_temp: 401
    transition: 1.213
    area_id:
      - - daniel_s_office
        - corridor
    entity_id: []
  target:
    area_id:
      - - daniel_s_office
        - corridor
    entity_id: []

As you can see, instead of areas being a list of areas, it somehow turns into a list with a list of areas.

Alright, so the plot thickens. After a productive face-to-the-desk debugging session, I noticed that somehow the entities parameter doesn’t suffer the same issue. I rewrote the code to this masterpiece below, and lo and behold, it seems like anything I put into the area_id target parameter (and only that parameter) is transformed into a list.

Script:

service: light.turn_on
data:
  brightness: "{{ (range(100,250)|random)|int }}"
  color_temp: "{{ (range(400, 500)|random)|int}}"
  transition: "{{ (range(800, 1500)|random)/1000 }}"
target:
  area_id: "{{ 'foobar' }}"
  entity_id: "{{entities|default([])}}"

Result:

  domain: light
  service: turn_on
  service_data:
    brightness: 170
    color_temp: 468
    transition: 0.875
    area_id:
      - foobar
    entity_id: []
  target:
    area_id:
      - foobar
    entity_id: []

So at this point, I have absolutely no idea what’s going on. What is even happening here? I’m not entirely sure how to even find a workaround, other than accepting the limitation that my script will only work with a singular area.