per the debate in this post: json-conversion-in-javascript
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, an array is legal as top-level JSON-text.
There are four standard documents defining JSON: RFC 4627, RFC 7159 (which obsoletes RFC 4627), ECMA-404, and RFC 8259 (which obsoletes RFC 7159, and calls ECMA-404 normative). They differ in which top-level elements they allow, but all allow an object or an array as the top-level element.
"A JSON text is a serialized object or array."
"A JSON text is a serialized value. Note that certain previous specifications of JSON constrained a JSON text to be an object or an array." Section 2
"A JSON text is a sequence of tokens formed from Unicode code points that conforms to the JSON value
grammar."