Json evaluate id

Hello, how can i evaluate an id from a json api ?

i have a list like this

visible_instructors:[{}]
[{
  "id": 0,
  "parent": 2,
  "name": "Grand Child 1"
}, {
  "id": 1,
  "parent": 2,
  "name": "Grand Child 2"
}]

so when i call it like that

{{ $json.visible_instructors[""0""].name }}

i get the error

 bad character U+005B '['  

i wonder how i could escape the 0 id

I’m not familiar with this syntax, is that some kind of javascript's map.filter()?

This look like you are not targeting the id key here, but rather the index which coincidently in your example are the same.

In go Template, you cannot access an array element this way, you have to use index:

{{ (index $json.visible_instructors 0).name }}
2 Likes

it works, thanks a million!!

1 Like