JSON (full name: JavaScript Object Notation object notation) is a lightweight text data exchange format. The data format of JSON is actually the dictionary format in python , which can contain arrays enclosed in square brackets, which are lists in python.
JSON is language independent
JSON is self-descriptive and easier to understand
JSON than XML is smaller, faster, and easier to parse
Crawlers often obtain interface data, which is in JSON format
2. JSON long What does it look like?
Grammar format : {key1:value1, key2:value2,} Key-value pair format (separated by colon), use commas to connect the pairs
1. The key part of the key-value pair of json must be wrapped in double quotes ", single quotes will not work (so if keywords appear in the key, they will also be characterized), and objects in js are not mandatory Requirements (so keywords are not allowed in the key).
2. The value part of the key-value pair of json is not allowed to have function, undefined, NaN, but it can have null, the value of the object in js can appear in.
3. After the json data ends, meaningless commas are not allowed to appear, such as: {"name":"admin","age":18,}, Pay attention to the comma after 18 at the end of the data, which is not allowed.
The above is the detailed content of How to use Python's json standard library. For more information, please follow other related articles on the PHP Chinese website!
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn