Defined
JSON-Lightweight Text data Interchange Format, language independent, smaller and faster and easier to parse than XML
JSON parser and JSON library support for different programming languages
4 Basic Rules
1. Use commas between the parallel data,
2. The map is represented by a colon
3. Parallel data sets (arrays) are denoted by square brackets []
4. The mapped collection (object) is represented by curly braces {}
For example, Beijing area 16800 square kilometers population 16 million people Shanghai area 6400 square kilometers, population 18 million people
[City: Beijing, Area: 16800, Population: 1600},{City: Shanghai, Area: 6400, population: 1800}]
Advantages
1 simple, small 2. Multi-lingual support
Disadvantages
The character set must be Unicode
Using JSON in Python
| function |
Program Library |
| Encode |
Encodes a Python object as a JSON string representation. |
| Decode |
Decodes a JSON-encoded string into a Python object.
|
JSON Basic Learning