What is JSON?

JSON is a data structure replacing XML. Compared to XML, it is smaller but equally descriptive. Its compactness reduces more network traffic, thereby speeding up data transmission.

So, what is JSON?

JSON is a string sequence with elements marked by specific symbols.

Double parentheses represent an object.

brackets indicate an array

"Within the double quotes is an attribute or value"

: The colon indicates that the latter is the value of the former (which can be a string, number, or even another array or object).

So, {"name": "Michael"} can be understood as an object containing the name "Michael".

An array containing two objects, represented as [{"name": "Michael"}, {"name": "Jerry"}], indicates an array with two entries.

Of course, you can also use `{ "name": ["Michael", "Jerry"] }` to simplify the previous one; it's an object with a "name" array.

PS: Many still have misconceptions. Why {name:'json'} fails in validation? It's because the latest specification on the JSON website states that for strings, both keys and values should ideally be enclosed in double quotes. Therefore, the correct code is {"name":"json"}.

Don't argue; that's how it's defined on the official website.

You recently used:

收藏: favorite Menu QQ