[JS] JSON in javescript


JSON, JavaScript object notation, is a data exchange format created by Douglas Crockford inspired by the literal representation of JS.
JSON is designed to be a minimalist, lightweight and textual subset of JavaScript. The less consensus is needed to achieve interoperability, the easier it will be to achieve interoperability.

The common JSON in our development is as follows
“color”: “red”,
“shape”: “square”,
“age”: 13

But in fact, JSON format is not the only one like this.
JSON can be formatted as follows:
1. Pure numbers. For example, 333 is JSON.
2. A string wrapped in double quotation marks, such as “666” is JSON. (the ‘666’ in single quotation marks is not)
3. Boolean value. A separate true or a separate false is JSON.
4. The special character null is JSON. (note that undefined, Nan and infinity are not JSON)
5. Array. (note that undefined, Nan, infinity cannot appear in the array)
6. JSON object. (Note: all keys must be in double quotation marks)

[JS] JSON in javescript
[JS] JSON in javescript
[JS] JSON in javescript
[JS] JSON in javescript
(refer to this website for judgment criteriahttps://jsonlint.com/

In addition, function() {} is not JSON.

Therefore, when using JSON. Parse (JSON. Stringify (obj)), undefined, Nan, infinity and function are ignored.

Synchronize updates to your own language bird