Official explanation
JSON (JavaScript Object Notation) is a lightweight data interchange format that is easy for people to read and write. It is also easy for machine parsing and generation. It is based on the JavaScript programming Language,json in a completely language-independent text format, but also uses a language similar to the C family, which makes JSON an ideal data exchange language
What is JSON
First, JSON is a string
Strings are used to pass information, and a JSON string is actually a string that specifies the format
In this format, we can pass information to each other in different programming languages, for example, we can convert the Javascrupt object to JSON and pass it to Java, so that Java can parse the object that the Java language itself represents, so we can turn the Java object into JSON, By parsing the Json,python language, the JSON can be translated into its own dictionary or List,json to unify the communication format so that the information can be transferred smoothly between different languages.
A simple example of JSON parsing
For example, we can turn the JSON string into the Python language dict
#Coding:utf-8ImportJsonjson_str="""{"id": +, "name": "Python", "url": "Http://www.v2ex.com/go/python", "title": "Python", "Title_alt Ernative ":" Python "," topics ": 7646," stars ": 4862," header ":" Here we discuss a variety of Python language programming topics, including Django,tornado boxes The discussion of the frame. Here is a place to help you solve practical problems. "," footer ": null," created ": 1278683336," Avatar_mini ":"//v2ex.assets.uxengine.net/navatar/8613/985e/90_ mini.png?m=1504080972 "," Avatar_normal ":"//v2ex.assets.uxengine.net/navatar/8613/985e/90_normal.png?m= 1504080972 "," Avatar_large ":"//v2ex.assets.uxengine.net/navatar/8613/985e/90_large.png?m=1504080972 "}"""Res=json.loads (JSON_STR)Print(res['ID'])# -Print(res['name'])#pythonPrint(res['URL'])#Http://www.v2ex.com/go/python
What is JSON