and Data Exchange
Before we learn what JSON is, it is important to be familiar with the concept of 'data exchange'.
The typical IT department of any business is bound to have multiple applications running. Consider a banking scenario. The bank will have multiple application servers for meeting various requirements like data mining, core banking, security, etc., Each of these applications may come from different vendors, and will run on different platforms. For example, the security application may have been built on C and running on a unix system while the data mining application may have been built using java on a Windows platform.
Typically, these applications will operate on data obtained from the database. Alternately, the data may get serially processed - data from one application may be processed and then output to another application for further processing. In either case, it is important for the different applications to talk to each other and exchange information. Theoretically, this may sound simple. But practically, it is a little more complicated because the applications are from different vendors and operate on different platforms. So they will have different ways of structuring data and understanding structured data.
So for example, if application A structures data in the form: data1, data2, data3, data4....data n
and application B structures data in the form: data n, data n-1,...data1
Clearly, there will be misunderstanding between the two applications when they communicate with each other in the above scenario, especially when the order of data matters.
This is why, we need a standard way to store data so that it can be exchanged without ambiguity between applications.
Why can't XML be good enough
XML is usually the 'go to' syntax to achieve data exchange. XML is still the widely used data exchange format. A typical XML file will look like this:
* First of all, it would be hard not to notice all the tags. XML is clunky. The tags take up a lot of space and increase the file size. * Second, the applications that access the XML file need to be aware of how to parse the file. So they have to be specially programmed for it.
So What is JSON
JSON is a successor to XML, and provides all the advantages of XML without many of the disadvantages. The above XML example would look as follows
As you can see from the example, JSON is a lot succint compared to XML. Without the tags, it occupies much less space. Also, notice that it uses curly braces, colons and double quotes. Programmers are more comfortable with this notation because the syntax looks very similar to some of the programming languages, especially c.
data. They can use the data as is!