Access arrays

When data is an array of objects, access each object directly using the square bracket notation [] and the reserved word i, which represents the ith item of the array.

Zero-based arrays are used:

  • the first item of an array is [i=0] or [0],

  • the second item of an array is [i=1] or [1],

etc.

Data

[
  { "movie": "Inception" },
  { "movie": "Matrix" },
  { "movie": "Back to the future" }
]

My preferred movie is {d[i=1].movie}

Last updated