Difference between XML and JSON
Main difference
XML and JSON are the data exchange formats used in web application development. Both are different from each other and are used in their correct place. JSON is extended from JavaScript, while XML has been extended from SGML. The syntax of JSON is more lightweight than XML in that JSON does not contain start and end tags, but XML does have start and end tags. JSON supports data types and arrays, while XML does not provide data types and does not support arrays. XML support for namespaces and comments, while JSON does not support namespaces and comments
What is XML?
XML is the data exchange format used in web application development. XML stands for “Extensible Markup Language“. It is an extension to the Standard Generalized Markup Language (SGML). It contains a set of rules for encoding a document so that it is readable by humans and machines. It is comparatively heavy. Through the mixed use of attributes and elements, it supports objects along with compatible namespaces. and comments.
What is JSON?
JSON is the data exchange format used in web application development. JSON stands for “JavaScript Object Notation”. It extends from JavaScript. It is a text-based format and is therefore human readable. It is much lighter and faster. It supports objects but not comments or namespaces.
Key differences
- JSON is extended from JavaScript, while XML has been extended from SGML.
- XML stands for “Extensible Markup Language“, while JSON stands for “JavaScript Object Notation”.
- JSON syntax is lighter than XML
- JSON does not contain start and end tags, but XML does have start and end tags.
- JSON supports data types and arrays, while XML does not provide data types and does not support arrays.
- XML support for namespaces, while JSON does not support namespaces
- XML support for Comments, while JSON does not support Comments.
- JSON is better for web services, while XML is better for configuration.
- JSON data cannot be changed to other formats while XML data can be changed to other formats like plain text, JSON.
- The mapping is quite easy in JSON than in XML since JSON is data oriented while XML is document oriented.