Technology

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

  1. JSON is extended from JavaScript, while XML has been extended from SGML.
  2. XML stands for “Extensible Markup Language“, while JSON stands for “JavaScript Object Notation”.
  3. JSON syntax is lighter than XML
  4. JSON does not contain start and end tags, but XML does have start and end tags.
  5. JSON supports data types and arrays, while XML does not provide data types and does not support arrays.
  6. XML support for namespaces, while JSON does not support namespaces
  7. XML support for Comments, while JSON does not support Comments.
  8. JSON is better for web services, while XML is better for configuration.
  9. JSON data cannot be changed to other formats while XML data can be changed to other formats like plain text, JSON.
  10. The mapping is quite easy in JSON than in XML since JSON is data oriented while XML is document oriented.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button