This article mainly introduces Python's standard module package JSON detailed information, the need for friends can refer to the following
Introduction
For Web developers, JSON text must be familiar and skilled to use. Most Web site API calls return data, which is in JSON format. If you look at what the JSON object contains, it's came David to be able to match the JSON data type with the Python data type.
So what's the use of Python's standard module package JSON? Why should I use the format of JSON to format python? Why can't I use JSON-formatted data directly? Is it almost the same type and corresponding?
In fact, after looking at the data structure carefully, it can be seen that there are subtle differences between the original JSON format and several Python data types. Here, you first list the corresponding formats that are converted between the two:
Python ==> jsondict ObjectList, tuple arraystr, Unicode stringint, long, float Numbertrue truefalse falsenone nulljson ==> pythonobject dictarray ListString unicodenumber (int) int, longnumber (real) floattrue truefalse False
JSON common 4 functions
' Dump ' ' dumps ' load ' loads '
Where ' dump ' is paired with ' load ', it is mainly used for large data situations. ' Dumps ' and ' loads ' apply to cases where the string or data is small. The main is the former converted to write the file to save, the latter conversion finished directly loaded in memory.
"Recommended"
1. Python Free video tutorial
2. Python Learning Manual
3. Python Object-oriented video tutorial