原文地址: https://www.json.org/json-en.html
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language Standard ECMA-262 3rd Edition - December 1999. JSON 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. These properties make JSON an ideal data-interchange language.
JSON is built on two structures:
- A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.
- An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.
These are universal data structures. Virtually all modern programming languages support them in one form or another. It makes sense that a data format that is interchangeable with programming languages also be based on these structures.
In JSON, they take on these forms:
对象(object)是一组无序的 name/value 对。 对象以 { 左大括号 开始,以 } 右大括号 结束。 每个 name 后面都有 : 冒号,name/value之间以 , 逗号分隔。
数组(array)是值的有序集合。 数组以 [ 左括号 开始,以 ] 右括号 结束。 多个值由 , 逗号分隔。
值(value)可以是双引号中的 string、number、true or false or null、an object or an array。 这些结构可以嵌套。
字符串(string)是零个或多个 Unicode 字符的序列,用双引号("")括起来,使用反斜杠()转义。 一个字符表示为单个字符串。字符串非常类似于 C 或 Java 字符串。
数字(number)与 C 或 Java 数字非常相似,只是不使用八进制和十六进制格式。
可以在任何一对标记之间插入空格。