Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Difference between xml and json
1. Difference between XML and JSON
S.No XML JSON
1 Abbreviation: Abbreviation:
XML stands for Extensible JSON stands for JavaScript Object
Markup Language. Notation.
2 Meaning: Meaning:
XML is a markup language that JSON is a text-based open standard
defines a set of rules for encoding designed for human-readable data
documents in a format that is both interchange. It is derived from the
human-readable and machine- JavaScript scripting language for
readable. It is defined in the XML representing simple data structures and
1.0 Specification produced by the associative arrays, called objects.
W3C, and several other related Despite its relationship to JavaScript, it
specifications,all gratis open is language-independent, with parsers
standards.The design goals of available for many languages.The
XML emphasize simplicity, JSON format is often used for
generality, and usability over the serializing and transmitting structured
Internet.It is a textual data format data over a network connection. It is
with strong support via Unicode used primarily to transmit data
for the languages of the world. between a server and web application,
Although the design of XML serving as an alternative to XML.
focuses on documents, it is widely
used for the representation of
arbitrary data structures, for
example in web services.
3 Type of format: Type of format:
Markup language Data interchange
4 Extended from: Extended from:
SGML JavaScript
5 Developed by: Developed by:
World Wide Web Consortium The JSON format was originally
specified by Douglas Crockford for
using it at State Software, a company
co-founded by Crockford, starting
around 2001.
6 Data types: Data types:
Does not provide any notion of Provides scalar data types and the
data types. One must rely on XML ability to express structured data
Schema for adding type through arrays and objects.
information.
7 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
2. 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.
9 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.
10 Comments: Comments:
Native support and usually Not supported.
available through APIs.
11 Namespaces : Namespaces :
Supports namespaces, which No concept of namespaces. Naming
eliminates the risk of name collisions are usually avoided by
collisions when combining nesting objects or using a prefix in an
documents. Namespaces also object member name (the former is
allow existing XML-based preferred in practice).
standards to be safely extended.
12 Formatting decisions : Formatting decisions :
Complex. Requires a greater Simple. Provides a much more direct
effort to decide how to map mapping for application data. The only
application types to XML exception may be the absence of
elements and attributes. Can date/time literal.
create heated debates whether an
element-centric or attribute-
centric approach is better.
13 Size : Size :
Documents tend to be lengthy in Syntax is very terse and yields
size, especially when an element- formatted text where most of the space
centric approach to formatting is is consumed (rightly so) by the
used. represented data.
14 Parsing in JavaScript : Parsing in JavaScript :
Requires an XML DOM No additional application code
implementation and additional required to parse text; can use
application code to map text back JavaScript's eval function.
into JavaScript objects.
15 Learning curve : Learning curve :
Generally tends to require use of Very simple technology stack that is
3. 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 support—such as editors and
widely available from many formatters—is scarce.
industry vendors.
17 Microsoft .NET Framework : Microsoft .NET Framework :
Very good and mature support None so far, except an initial
since version 1.0 of the .NET implementation as part of ASP.NET
Framework. XML support is AJAX.
available as part of the Base Class
Library (BCL). For unmanaged
environments, there is MSXML.
18 Platform and language : Platform and language :
Parsers and formatters are widely Parsers and formatters are available
available on many platforms and already on many platforms and in
languages (commercial and open many languages. Consult json.org for a
source implementations). good set of references. Most
implementations for now tend to be
open source projects.
19 Integrated language : Integrated language :
Industry vendors are currently Is natively supported in
experimenting with support JavaScript/ECMAScript only.
literally within languages. See
Microsoft's LINQ project for
more information.
References:
http://en.wikipedia.org/wiki/XML
http://en.wikipedia.org/wiki/JSON
http://www.vinaytechs.com/2009/10/introduction-to-javascript-object.html
And, further updates on difference between questions and answers, please visit my blog @
http://onlydifferencefaqs.blogspot.in/