Pulling attribute from event sensor not working

Hey Guys,

so my problem is, that if I try to read one, or even two attributes “deep” into the dict, then it works. But as soon as I read the second one, the output changes from dict to list, I can’t read any more attributes:

{{state_attr('event.change', 'new')}}

This works fine and gives back a dictionary:

{
  "start": 
  "end": 
  "id": 967799,
  "lsnumber": 239000,
  "code": "cancelled",
  "type": "ls",
  "subjects": [
    {
      "name": "xyz",
      "long_name": "xy"
    }
  ],
  "rooms": [

[...]

But now, the code suddenly gives back a list:

{{state_attr(event.change', 'new_lesson')["subjects"] }}
[
  {
    "name": "xyz",
    "long_name": "xy",
  }
]

Now, something like

{{state_attr('event.change', 'new')["subjects"]["name"]}}

doesn’t work, and I get the error message: “‘list object’ has no attribute ‘name’”
What am I doing wrong here, and could I read out the attribute?
So my goal is to just get “xyz” as an output.
Thanks in advance

You can use index to select the first item from the list like:

{{ state_attr('event.change', 'new')['subjects'][0]['name'] }}

Thanks, worked immediately!