JSON stands for “JavaScript Object Notation”. It is a lightweight data-interchange format. It is used for transmitting data between a server and a web application as an alternative to XML. This format is often used for serializing and transmitting structured data over a network connection. The machines can easily parse and generate it.
Rules for Syntax:
- Data should be represented in name/value pairs.
- Each data is separated by commas
- To hold the object, use the curly braces
- To hold an array, use square brackets
Advantages of JSON:
1. Speed:
It is much faster than XML as the syntax is very small and light in weight.
2. Server Parsing:
The speed of the server depends on how fast the parsing is done at the server side so that JSON format itself supports easy parsing of data.
3. Tool for sharing data:
The files with any size can be shared using JSON. The video and audio files can also be easily shared.
Disadvantages of JSON:
1. Error Handling:
The errors cannot be handled for JSON calls.
2. Dynamic Script Limit:
When the dynamic script insertion works, JSON works perfectly but the insertion cannot be done in it. It fails without any intimation.
3. Trustworthiness:
It can be hacked when used by untrusted services or browsers.