How XML differs from JSON?
In this guide, we will learn the differences and similarities between JSON and XML.
Before we see the differences between XML and JSON, lets see the example of a JSON file and the same data in XML file.
A simple example of a student array data in JSON format.
The same above example in XML document.
JSON vs XML
1 JSON is simple and easier to read and write XML is verbose and less readable
2 JSON doesn’t use end tag In XML, the end tag is mandatory
3 JSON supports array thus it is easy to transfer a big chunk of homogeneous data items using JSON XML doesn’t support array
5 JSON is short XML document is lengthy, verbose and redundant
6 JSON is less secure than XML XML is more secured than JSON
7 JSON file is more readable than XML because it is short and to the point. XML file is big and filled with user-defined tags, thus less-readable
8 JSON is data-oriented XML is document-oriented
Similarities between JSON and XML
1. Both JSON and XML are human readable language.
2. Both JSON and XML support unicode, thus any human written language can be written in JSON and XML documents.
3. Both JSON and XML can be parsed.
4. The data in both JSON and XML can be fetched using XMLHttpRequest.