14 Difference Between JSON And XML

Table of Contents

What Is JSON(JavaScript Object Notation)?

JSON is an open standard file format and data interchange format, that uses human-readable text to store and transit data objects. It is used primarily to transmit data between a server and web application, as an alternative to XML. JSON defines seven value types: string, number, object, array, true, false and null.

JSON is built on two structures:

  • A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list or associative array.
  • An ordered list of values. In most languages, this is realized as an array, vector, list or sequence.

JSON is often used as a common format to serialize and deserialize data in applications that communicate with each other over the Internet. These applications are created using different programming languages and run in very different environments. JSON is suited to this scenario because it is an open standard, it is easy to read and write and it is more compact than other representations.

What You Need To Know About JSON

  • JavaScript Object Notation (JSON) is one type of text-based format or standard for interchanging data i.e Human readable.
  • JSON is developed by Douglas Crockford.
  • JSON is extended from JavaScript language from where it puts the feature to represent the data in a way of representing objects.
  • JSON does not provide any support for name-spaces but supports Arrays.
  • JSON is data oriented and can be mapped more easily.
  • JSON has support of native objects.
  • JSON does not support comments.
  • JSON syntax is lighter than XML as JSON has serialized format of data having less redundancy. JSON does not contain start and end tags.
  • JSON supports data-type including integer and strings, JSON also support array.  
  • JSON files are easy to read as compared to XML.
  • JSON is less secured.
  • JSON supports only UTF-8 encoding.
  • It is supported by many Ajax toolkit.
  • You cannot change JSON data to another format.
  • What Is XML (Extensible Markup Language)?

    Extensible Markup Language (XML) is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. The basic building block of an XML document is an element, defined by tags. An element has a beginning and an ending tag. All elements in an XML document are contained in an outermost element known as the root element. XML can also support nested elements or elements within elements. This ability allows XML to support hierarchical structures. Element names describe the content of the element, and the structure describes the relationship between the elements. XML also supports the ability to define attributes for elements and describe characteristics of the elements in the beginning tag of an element.

    XML data is known as self-describing or self-defining, meaning that the structure of the data is embedded with the data, thus when the data arrives there is no need to pre-build the structure to store the data; it is dynamically understood within the XML. The XML format can be used by any individual or group of individuals or companies that want to share information in a consistent way. XML is actually a simpler and easier-to-use subset of the SGML (Standard Generalized Markup Language), which is the standard to create a document structure.

    What You Need To Know About XML

  • The Extensible Markup Language (XML)is a Markup Language having format that contains set of rules for the encoding the documents which is readable for both human and Machine.
  • XML is developed by W3C (World Wide Web Consortium).
  • XML is extended from SGML (Standard Generalized Markup Language) and uses tag structure to represent data items.  
  • XML support name-spaces but does not support Arrays.
  • XML is document oriented and needs more effort for mapping.
  • XML can get support of objects through mixed use of attributes and elements.
  • XML supports comments.
  • XML is not so lighter as JSON having start and ends tags and it takes more character than JSON to represent same data.
  • XML does not provide any data type so needs to be parsed into particular data-type. XML has no direct support for array.
  • XML documents are relatively more difficult to read and interpret.
  • XML is more secure than JSON.
  • XML supports UTF-8 encoding and other various types of encoding.
  • It not fully supported by Ajax toolkit.
  • In XML, using XSLT you can change XML data into another format like comma-delimited, plain text, JSON etc.
  • Difference Between JSON And XML In Tabular Form

    BASIS OF COMPARISONJSONXML
    DescriptionJavaScript Object Notation (JSON) is one type of text-based format or standard for interchanging data i.e Human readable.  The Extensible Markup Language (XML)is a Markup Language having format that contains set of rules for the encoding the documents which is readable for both human and Machine.  
    DevelopmentJSON is developed by Douglas Crockford.  XML is developed by W3C (World Wide Web Consortium).  
    ExtensionJSON is extended from JavaScript language from where it puts the feature to represent the data in a way of representing objects.  XML is extended from SGML (Standard Generalized Markup Language) and uses tag structure to represent data items.   
    Support For Name-Spaces But Supports ArraysJSON does not provide any support for name-spaces but supports Arrays.  XML support name-spaces but does not support Arrays.  
    NatureJSON is data oriented and can be mapped more easily.  XML is document oriented and needs more effort for mapping.  
    Support of Native ObjectsJSON has support of native objects.  XML can get support of objects through mixed use of attributes and elements.  
    Support For CommentsJSON does not support comments.  XML supports comments.  
    Start & End TagsJSON syntax is lighter than XML as JSON has serialized format of data having less redundancy. JSON does not contain start and end tags.  XML is not so lighter as JSON having start and ends tags and it takes more character than JSON to represent same data.  
    Data-TypeJSON supports data-type including integer and strings, JSON also support array.    XML does not provide any data type so needs to be parsed into particular data-type. XML has no direct support for array.  
    Document Reading & InterpretationJSON files are easy to read as compared to XML.  XML documents are relatively more difficult to read and interpret.  
    SecurityJSON is less secured.  XML is more secure than JSON.  
    UTF-8 EncodingJSON supports only UTF-8 encoding.  XML supports UTF-8 encoding and other various types of encoding.  
    Ajax ToolkitIt is supported by many Ajax toolkit.  It not fully supported by Ajax toolkit.  
    Change Of DataYou cannot change JSON data to another format.  In XML, using XSLT you can change XML data into another format like comma-delimited, plain text, JSON etc.  
    Previous article5 Difference Between Deterministic And Non-deterministic AlgorithmsNext article5 Difference Between Embassy And High Commission

    ncG1vNJzZmiumauupbXFn5yrnZ6YsrR6wqikaJyZm7OmvsSnmp5lkprBuLHEp2Sjq5%2BjeqK6w2avpqRf