Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Json1
1. Python JSON
JSON, Javascript object notation.
It is a small lightweight data format.
A packet of JSON data is almost the same as a python dictionary.
It is shorter than XML.
JSON is an ideal format for parsing data between a client and a server.
Don't worry, if your client is not a browser, android and other mobile operating systems are
working with JSON.
JSON supposed to be readable by any person who used c-style language. So, python is also a c-
style language.
JSON can support primitive type, like string and number & nested list as well as object also.
2. It is used to store information in an easy or organized manner.
It stores information in a human-readable form.
Why do we use JSON?
JSON is less verbose and JSON has a more compact style than XML.
It is more readable.
JSON is very fast, XML software can take more time for parsing either JSON parsing is very
fast.
Parsing JSON
It means convert of certain JSON datatype to python datatype and converts python datatype into
JSON datatype.
JSON Syntax rule:
1. The data is always in key/value pairs.
2. A data object is separated by a comma.
3. The object is held with a curly bracket {}.
4. Arrays held in square bracket [].
JSON Object:
{
"Name":"harsh",
3. "occupation":"student"
}
It is one object in this object there is a name and occupation is keys and harsh, the student is
value.
JSON Datatype:
1. String datatype:{ "name" : "honey"}
2. Number datatype:{ "age" : 21}
3. booleon:{ "sales" : true}
JSON VS XML:
Few similarities between them:
Easy to read
Both are nested and hierarchical
Both can parse using a wide variety of languages.
few difference between them:
It has no tag format
faster to read & write
It uses arrays while not use in XML.
JSON in Python
In python, JSON is a built-in package used to transfer data between client and server.
Parse JSON: Convert from JSON to Python
4. The loads() method can be used to convert the JSON string into a python object.
Conver From Python to JSON:
dumps() method can be used to convert a python object into a JSON string.
You can convert a listof python datatype into a JSON string.
PYTHON JSON
dict object
list array
5. tuple array
string string
int number
float number
True true
False false
None Null
Ex:
Advantages of JSON:
1.JSON is Faster:
JSON syntax is very easy and it requires less time for parsing. So, that is the reason it is
very faster.
2.Schema Support
JSON can support a wide range of browsers.
3.Server Parsing:
On a server-side parsing is a very important factor. So, developers want to parse fast on
the server-side, and in JSON parsing on the server-side is very faster.
4.Tool for Sharing Data:
JSON is the best tool for sharing the purpose of audio, video, etc. It stores data in arrays
format to make data transfer easier.
6. Disadvantages of JSON:
1. It has no error handling for JSON calls.
2. JSON is dangerous if used as a trustable or untrustable browser.
3. It is not secure.
4. Limitation in terms of the datatype.