Array Literals
Array literals create ordered collections. Elements are specified as a comma-separated list of expressions within brackets.
ArrayLiteral = "[" [ Expression { "," Expression } ] "]" ;
Valid Syntax:
[]
[1, 2, 3]
["a", "b", "c"]
[{ "id": 1 }, { "id": 2 }]
Notes
- Trailing commas are not permitted in array literals
- Elements can be any valid expression including nested objects and arrays