1, grammar
JSON has three kinds of values
simple values: using the same syntax as JavaScript, you can represent strings, numeric values, Booleans, and Null in JSON. However, JSON does not support special value undefined in JavaScript.
object: An object as a complex data type that represents a set of unordered key-value pairs. The value in each key-value pair can be a simple value, or it can be a value of a complex data type.
Array: A group of numbers is also a complex data type that represents an ordered set of worthwhile lists that can be accessed by a numeric index. The value of an array can also be any type-----simple value, object, or array.
1. Simple values
5//Number
"HELLO World"//String
2. Objects
The objects in JSON are somewhat different from those in JavaScript, in fact the structure of objects in JSON is the same as dictionaries in other languages. Here is the representation of the object in JavaScript
var person = {
Name: "Zhangsan",
Age:29
}
In JSON, the standard notation is
var person = {
"Name": "Zhangsan",
"Age": 29
}
3. Arrays
[
{
"Name": "Zhangsan",
"Person": {
}
},
]
20.1 Chapter JSON syntax