JSON (JavaScript Object Notation) is a lightweight data-interchange format.
JSON was first presented to the world at the JSON.org website in 2001. A definition of the JSON syntax was subsequently published as IETF RFC 4627 in July 2006. ECMA-262, Fifth Edition (2009) included a normative specification of the JSON grammar. This specification, ECMA-404, replaces those earlier definitions of the JSON syntax. Concurrently, the IETF published RFC 7158/7159 and in 2017 RFC 8259 as updates to RFC 4627. The JSON syntax specified by this specification and by RFC 8259 are intended to be identical.
Advantages
- It is easy for humans to read and write.
- It is easy for machines to parse and generate.
- It is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others.
JSON does not support cyclic graphs, at least not directly. JSON is not indicated for applications requiring binary data.
Two Structures
- A collection of name/value pairs.
- An ordered list of values.
Forms
1、An object begins with {left brace and ends with }right brace . Each name is followed by :colon and the name/value pairs are separated by ,comma.
2、An array is an ordered collection of values. An array begins with [left bracket and ends with ]right bracket. Values are separated by ,comma.
3、A value can be a string in double quotes, or a number, or true or false or null, or an object or an array. These structures can be nested.
4、A string is a sequence of zero or more Unicode characters, wrapped in double quotes, using backslash escapes. A character is represented as a single character string. A string is very much like a C or Java string.
5、A number is very much like a C or Java number, except that the octal and hexadecimal formats are not used.
Whitespace can be inserted between any pair of tokens.
//References
[1] Standard ECMA-404 [The JSON Data Interchange Syntax ] 2nd Edition / December 2017(https://ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf)
[2] IETF RFC 8259 The JavaScript Object Notation (JSON) Data Interchange Format(https://www.rfc-editor.org/rfc/rfc8259.html)