It is currently described by two competing standards, RFC 7159 and ECMA-404. The ECMA standard is minimal, describing only the allowed grammar syntax, whereas the RFC also provides some semantic and security considerations.
- JSON is widely accepted in the softwares that includes client-server architecture for exchanging data between client and server.
- JSON is easy to use and purely text-based, lightweight, and human- readable format and people often misunderstand as replacement of XML.
- It is platform and language independent and inbuilt supported by almost all of the front line languages/frameworks like and support for the JSON data format is available in all the popular languages, some of which are C#, PHP, Java, C++, Python, and Ruby.
- The official Internet media type for JSON is
- The JSON file name extension is
Tip: An Internet media type is a standard identifier used on the Internet to indicate the type of data that a file contains.
Web Architecture Media Types
A typical web application transfers data between client and server. The client can be a web browser, mobile app, mobile browser and server can be application developed using Java or .NET. Client request to server by request methods such as GET, POST, PUT and DELETE, using standard protocols such as http, https, ftp etc. Depending on the request method, client sends data to server with any of the standard media types. Some of the accepted media types are as follows.
There are quite a many number of media types are used. Checkout the list from IANA website.
Where JSON is used?
JSON media type widely used in web architecture for transferring data between server and client.
Prior to JSON, XML was considered to be the chosen data interchange format for most of the cases. XML is heavy weight, it consumes more of network bandwidth in comparison to JSON. XML data is considerably complex for parsing. It requires an XML DOM implementation on the client side that would accept the XML response and convert into client program understandable format. It is often time consuming to implement in client side and it requires the complete XML DOM to be loaded into memory while parsing it.
The following image represents an example of xml data.
Let us now represent the above xml response into JSON format.
Notice that the size of the XML document is quite large compared to its representation in JSON. This result significant impact for larger size documents when used with real time applications.
Mobile is one of the counterpart of todays business. Which means if not today, tomorrow you will require your services to be accessible on mobile. As mobile devices are limited in memory and power, transmitting larger chunk of data is not recommended.
Thus JSON become one of the most preferred media format for data exchange between client and server.