You are on page 1of 3

Difference between XML and JSON S.No 1 XML Abbreviation: XML stands for Markup Language.

JSON Abbreviation: Extensible JSON stands for JavaScript Object Notation. Meaning: JSON is a text-based open standard designed for human-readable data interchange. It is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects. Despite its relationship to JavaScript, it is language-independent, with parsers available for many languages.The JSON format is often used for serializing and transmitting structured data over a network connection. It is used primarily to transmit data between a server and web application, serving as an alternative to XML.

Meaning: XML is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machinereadable. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications,all gratis open standards.The design goals of XML emphasize simplicity, generality, and usability over the Internet.It is a textual data format with strong support via Unicode for the languages of the world. Although the design of XML focuses on documents, it is widely used for the representation of arbitrary data structures, for example in web services. Type of format: Markup language Extended from: SGML Developed by: World Wide Web Consortium

3 4 5

Type of format: Data interchange Extended from: JavaScript Developed by: The JSON format was originally specified by Douglas Crockford for using it at State Software, a company co-founded by Crockford, starting around 2001. Data types: Provides scalar data types and the ability to express structured data through arrays and objects.

Data types: Does not provide any notion of data types. One must rely on XML Schema for adding type information.

Support for arrays: Support for arrays: Arrays have to be expressed by Native array support. conventions, for example through the use of an outer placeholder

element that models the arrays contents as inner elements. Typically, the outer element uses the plural form of the name used for inner elements. 8 Support for objects : Support for objects : Objects have to be expressed by Native object support. conventions, often through a mixed use of attributes and elements. Null support: Null support: Requires use of xsi:nil on Natively recognizes the null value. elements in an XML instance document plus an import of the corresponding namespace. Comments: Native support and available through APIs. Comments: usually Not supported. Namespaces : No concept of namespaces. Naming collisions are usually avoided by nesting objects or using a prefix in an object member name (the former is preferred in practice). Formatting decisions : Simple. Provides a much more direct mapping for application data. The only exception may be the absence of date/time literal.



Namespaces : Supports namespaces, which eliminates the risk of name collisions when combining documents. Namespaces also allow existing XML-based standards to be safely extended. Formatting decisions : Complex. Requires a greater effort to decide how to map application types to XML elements and attributes. Can create heated debates whether an element-centric or attributecentric approach is better. Size : Documents tend to be lengthy in size, especially when an elementcentric approach to formatting is used. Parsing in JavaScript : Requires an XML DOM implementation and additional application code to map text back into JavaScript objects.



Size : Syntax is very terse and yields formatted text where most of the space is consumed (rightly so) by the represented data. Parsing in JavaScript : No additional application code required to parse text; can use JavaScript's eval function.



Learning curve : Learning curve : Generally tends to require use of Very simple technology stack that is

several technologies in concert: already familiar to developers with a XPath, XML Schema, XSLT, background in JavaScript or other XML Namespaces, the DOM, and dynamic programming languages. so on. 16 Tools : Tools : Enjoys a mature set of tools Rich tool supportsuch as editors and widely available from many formattersis scarce. industry vendors. Microsoft .NET Framework : Very good and mature support since version 1.0 of the .NET Framework. XML support is available as part of the Base Class Library (BCL). For unmanaged environments, there is MSXML. Platform and language : Parsers and formatters are widely available on many platforms and languages (commercial and open source implementations). Microsoft .NET Framework : None so far, except an initial implementation as part of ASP.NET AJAX.



Platform and language : Parsers and formatters are available already on many platforms and in many languages. Consult for a good set of references. Most implementations for now tend to be open source projects. in


Integrated language : Integrated language : Industry vendors are currently Is natively supported experimenting with support JavaScript/ECMAScript only. literally within languages. See Microsoft's LINQ project for more information.

References: And, further updates on difference between questions and answers, please visit my blog @