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
{"student":[
{"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
<student>
<firstName>Mohit</firstName>
<lastName>Sharma</lastName>
<registered>Yes<registered>
</student>Commonalities between XML and JSON
- JSON and XML Data supports Unicode and thus widely used by multiple technology languages like Java, php,phython,.Net
- JSON and XML data supports XMLHttpRequest
- JSON and XML data supports parsing
- JSON and XML are both human readable language
Comparison between JSON and XML
- XML represents data in XML tags whereas JSON does not require tag for data representation
- JSON format is more easier and simple to READ & WRITE when compared with XML data
- XML does not supports ARRAY Data representation whereas JSON supports array and makes it easier to combine homogeneous data as a common set
- XML data parsing is difficult when compared to JSON data
- 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.
- JSON is data -oriented whereas XML is document- oriented
- XML data is more secured in comparison to JSON data