Difference Between XML and JSON

November 2022 · 2 minute read

Main Difference

XML and JSON are the data interchange formats used in development of web applications. Both are different from each other are used at their right place. JSON is extended from the JavaScript while that XML has been extended from SGML. Syntax of JSON is lighter than XML as JSON does not contain start and end tags but XML do have start and end tags. JSON supports datatype and arrays while XML does not provide datatype and does not support array. XML support for Namespaces and Comments while JSON does not support Namespaces and comments

What is XML?

XML is the data interchange format used in development of web applications. XML stands for “Extensible Markup Language”. It is extended from Standard Generalized Markup Language (SGML). It contains set of rules to encode a document to be readable for human and machine. It is comparatively heavy. By mixed use of attributes and elements, it supports objects along with supporting Namespaces. and Comments.

What is JSON?

JSON is the data interchange format used in development of web applications. JSON stands for “JavaScript Object Notation”. It is extended from JavaScript. It is text based format and thus is human readable. It is quite lighter and faster. It supports for objects but not for Comments and Namespaces.

Key Differences

  • JSON is extended from the JavaScript while that XML has been extended from SGML.
  • XML stands for “Extensible Markup Language” while JSON stands for “JavaScript Object Notation”.
  • Syntax of JSON is lighter than XML
  • JSON does not contain start and end tags but XML do have start and end tags.
  • JSON supports datatype and arrays while XML does not provide datatype and does not support array.
  • 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 changeable to other formats while XML data can be changed into other formats like plain text, JSON.
  • Mapping is quite easy in JSON than in XML as JSON is data oriented while XML is document oriented.
  • ncG1vNJzZmivp6x7pbXFn5yrnZ6Ysm%2FDyKSgaLCdoXq3v4yjqqimXw%3D%3D