Aug 22, 2015

Textual description of firstImageUrl

Why JSON is future of web centric development - Tug of war(XML vs JSON)

XML(Extensible Markup Language) and JSON(javaSctipt object notation) are the two most commonly used formats for data exchange/interchange over wires/internet or as data-source/ configuration file. XML is an old player() and JSON joined the show later. JSON is getting popularity and industries extensively using web-service are moving from XML to JSON. Does it mean Does XML is getting obsolete? or JSON is pushing XML and moving ahead?. Answer to this question is Yes and No both.
Yes, because JSON is lightweight(less bandwidth intensive) and data oriented, so it's popularity is increasing and industries are preferring it over XML. And same time No, because there are some who still use XML because of it document oriented and schema focussed features. JSON is absolutely not superior to the XML every where,it is use-case dependent.However We have to say loudly and admit it JSON has an edge over XML.
All major "Amazon Product Advertising API" uses only XML and at the same time Facebook Graph API, Google Maps API, Twitter API, AccuWeather API, Pinterest API, Reddit API, Foursquare API uses JSON.
It has been long, over the years developer community divided over XML and JSON and it is still on with compromising logic, neither JSON and XML is superior over each other,it is the use case which drive organization to select JSON or XML.Remember a decade ago, XML was the hero of the town(first choice of data interchange format) and it eliminated all the shortcomings of SGML(Standard Generalized Markup Language) and played a vital role in evolution of web.But now JSON is dominating this data centric world and all major players extensively using it as privileged data format.

Why JSON is becoming more popular and organization first choice for data exchange?
Advantage of JSON over XML:-

If Facebook, Google ,Twitter and Foursquare is using JSON , then I do not think there is an iota of doubt about JSON feature richness over XML.What we need to understand what makes JSON so adorable when it comes to exchanging data over internet.
  1. JSON less verbose than XML: JSON documents are very straight forward and it is data focused instead of  document oriented(XML documents). No extra ceremony is required other than { }( braces ) for objects , [ ] (brackets) for array and :(colon ) to separate key/value pair.However , XML requires little decoration to make a valid XML documents. It causes variation in size of the JSON document and XML document and in turn XML documents are more bandwidth intensive compared to JSON documents.So , transmission of JSON doc is faster compared to XML document. See below diagram to differentiate between XML and JSON doc. JSON doc is clearly light weight and less verbose than XML doc.
JSON Document sample XML Document sample
{  "firstname" : "Nikhil",
   "lastname" : "Ranjan"
   "employeeId": "007"
   "designation": "SSE"
   "Organization": "XYZ"
   "skills":["java":"8/10","javaSctipt":"6                /10","python":"5/10"]
  1. JSON processing is faster than XML document: Apart from small JSON document compared to XML document for same data, it has been found that processing speed of JSON document is faster than XML document. JSON is estimated to parse up to one hundred times faster than XML.Along with processing , serialization and deserialization of JSON can be performed efficiently than XML document.
  2. Less System CPU resource utilization: In terms of CPU utilization, experiment conducted by Nurzhan, Michael ,Randall and Clemente suggest that JSON document takes less system CPU resource than XML document. It states that , JSON document takes more user CPU and less system CPU and overall resource consumption is less in JSON document. More user CPU time is better because it makes less system call and so less system CPU utilization. See below diagram for broader picture regarding transmission time and CPU utilization:
Transmission and CPU utilization analysis: XML vs JSON (Source: A Case Study by Nurzhan)
  1. Natural support of data structure: JSON doc implicitly uses { } for object and [ ] for array
    and it helps it to map directly to the corresponding data structures in various other languages. Another important feature that makes it compatible with Object oriented environment is that namespace of each fields is resolved in Object scope independently. Some people see JSON as deficient in namespace resolution. 
  2. JSON parsing support for all well known high level language : JSON is subset of JavaScript. JSON works seamlessly not only with JavaScript but also with Java, Python, C++, etc. There are various tools and third party library available to support JSON parsing efficiently. For java we have Gson, Genson, Jackson and FlexJson. Read how to do JSON parsing in java here.
These are the significant features of JSON which makes it popular and preferred data exchange language.So,where ever there is need of transmission of data in bulk over wires , JSON is preferred. Now lets see what are the areas where JSON is making its presence these days.
  • NoSQL and Big data: In this Web-centic world high volume of data (Google Map, Airlines info, etc) is transmitted over wires, so it was inevitable to opt some data transmission format which will be efficient and less bandwidth intensive.The most popular NoSQL databases like MongoDB and CouchDB relied on JSON as most preferred data transmission format and JSON playing key role in dealing with high volume of data efficiently. Along with these NoSQL
    databases Amazon’s DynamoDB architecture is entirely based on REST/JSON and HBase(part of hadoop ecosystem) is mostly inclined towards JSON.
  • REST popularity as data transfer protocol:  SOAP is XML based well known data transfer protocol. However, SOAP is very bulky and industries is shifting towards REST for exposing most of the resources(except sending some confidential data) and JSON has played a crucial role to make REST as industries first preference over SOAP. With popularity of REST many organization like Twitter and ForSquare has shifted their API base to support JSON only.Some are supporting both XML and JSON so as their major APIs like Google Cloud Storage, Linkedin API, Flickr API. Here is the complete list of software/web system using XML/JSON.
  • Internet of things- Support for non computer device: It is expected that by 2020 the number of devices operable will explode from 20 million to 260 million and most of these devices will be using embedded system.Here lightweight JSON will be undisputed winner over XML.Future of JSON is bright.
  • Ubiquitous JavaScript : Days are gone when javaScript was considered as front end scripting language. With evolution of javaScript in the form of Node.js (a server-side JavaScript framework), full stack development with javaScript became a very possible and it is highly compatible with JSON(Remember JSON is javaScript subset). With Node.js and MongoDB, it is very possible to create a light weight application and serve to wide range to device. JSON data interchange format has Ecma standards blessing too so it is also motivating Web application development community to adopt JSON as data exchange format.
The "JSON" is future, when we think in terms of serving wide range of application and supporting or different types of language. Lets summarize it in one line: JSON will be first preference for data exchange.
Remember XML is not dead , So how do we appreciate XML in terms of its use ?
XML is document oriented (JSON is data oriented ) and XML makes its presence when we need represent document by giving semantic meaning to text through its tree-like structure.
 and XML has natural ability to represent mixed content (JSON does not have it , however it can be achieved).

Read also:
  1. JSON parsing in java - encoding and decoding JSON
  2. List of software system using JSON and XML
1.Comparison of JSON and XML Data Interchange Formats: A Case Study
2. A debate : XML vs JSON
Location: Hyderabad, Telangana, India