[Solved] Which form is valid between starting with square and curly brackets?


[ starts an array initializer. Valid entries are values separated by comments. Example:

["one", 2, "three"]

{ starts an object initializer. Valid entries are name/value pairs where each pair is a names in double quotes followed by a colon (:) followed by any valid value. Examples:

{"name": "value"}

{"name": {}}

{"name": ["one", 2, "three"]}

All of this is covered by the website and the standard.

Your first example is invalid because it’s trying to define a name/value pair where a value is expected (in an array entry).

4

solved Which form is valid between starting with square and curly brackets?