Difference between JSON and XML

The XMl and JSON are the medium for the data exchange among different applications. The tutorial provides the commonalities and comparison between JSON and XML data attributes.

Sample JSON data

    {"firstname":"Mohit", "lastname":"Sharma"},  
    {"firstname":"Rahul", "lastname":"Jain"},  
	{"firstname":"Pankaj", "lastname":"Verma"}

Sample XML Data

To understand the XML Basics, please refer the below published blog

XML Overview


Commonalities between XML and JSON

  1. JSON and XML Data supports Unicode and thus widely used by multiple technology languages like Java, php,phython,.Net
  2. JSON and XML data supports XMLHttpRequest
  3. JSON and XML data supports parsing
  4. JSON and XML are both human readable language

Comparison between JSON and XML

  1. XML represents data in XML tags whereas JSON does not require tag for data representation
  2. JSON format is more easier and simple to READ & WRITE when compared with XML data
  3. XML does not supports ARRAY Data representation whereas JSON supports array and makes it easier to combine homogeneous data as a common set
  4. XML data parsing is difficult when compared to JSON data
  5. JSON data is short and precise compared to XML. XML document is lengthy, redundant and includes additional XML tags for namespace and other XML validation.
  6. JSON is data -oriented whereas XML is document- oriented
  7. XML data is more secured in comparison to JSON data