Reason Json is popular.
Pradhuman Shrestha
1/4/2024What is JSON?
JSON stands for JavaScript Object Notation. It is a lightweight format for storing and transporting data that uses human-readable text to represent objects. JSON is self-describing, flexible, and easy to understand. More than 40% of sites use JSON and almost 95% of API returns and receive data in some form of JSON.
Example
{
"fruit": [
{"name": "Apple", "price":50},
{"name": "Orange", "price":70},
{"name": "Mango", "price":60},
]
}
For example fruit object is defined with an array of 3 fruit records.
History of JSON
JSON was introduced as a competitor of XML in the 1990s for large network systems such as Web applications, but due to its simplicity and efficiency, it becomes more popular.
JSON VS. XML
JSON is a text-based, human-readable, and language-independent data-interchange format which is a relatively new data format. But XML is more complicated and has been around for longer.
XML data are more verbose than JSON. It needs to be a specific data type for each node whereas JSON needs a specific data type for the top level only.
XML use angle brack whereas JSON uses curly braces to define data.
Why JSON
- serialize, store data in an array creating and transferring data is simple.
- syntax is easy to use and very small and light-weighted, so it executes and responds in a faster way.
- Almost all browser and language supports JSON and has a JSON parser available.
Conclusion
JSON is light-weighted, simple, and easy to create. It doesn't mean XML is bad. XML is also good. It varies with the nature of the project. XML is best for applications with complex requirements surrounding data interchange, such as in enterprise.
So, this much is for today hope it was helpful. If it is please share it with your friends. Thank you.