Can an array be top
每个在这篇文章中的辩论:json-conversion-in-javascript
Yes, an array is legal as top-level JSON-text.
There are three standard documents defining JSON: RFC 4627, RFC 7159 (which obsoletes RFC 4627), and ECMA-404. 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."
"A JSON text is a sequence of tokens formed from Unicode code points that conforms to the JSON value grammar."
Yes , but you should consider making the root an object instead in some scenarios, due to JSON hijacking. This is an information disclosure vulnerability based on overriding the array constructor in JavaScript.
这是来自ECMAScript规范。
JSONText : JSONValue JSONValue : JSONNullLiteral JSONBooleanLiteral JSONObject JSONArray JSONString JSONNumber链接地址: http://www.djcxy.com/p/47772.html
上一篇: ASP.NET Web API将JSON作为对象返回
下一篇: 数组可以顶部