XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] List of differences between XML and JSON?

On Thu, 30 Apr 2015 14:23:27 +0000, Costello, Roger L. wrote:
> -          XML supports processing instructions, JSON does not.

Entities and notations, as well. Not sure which, if any of these, are 
actually interesting in JSON context.

> -          XML provides multiple syntaxes to express things (e.g., 
> attribute values can be delimited by either a single or double quote, 
> attributes can be in any order), JSON does not have such flexibility.

Child nodes in XML (text, elements, comments, PIs) have implicit 
sequence. Outside of canonicalization, attributes and namespaces may 
appear in any order, but must be unique. One can argue that JSON 
primitive values (null, boolean, number, string) are more "like" XML 
attributes than "like" XML child elements.

> -          XML uses canonicalization to convert the XML into a 
> standard form, JSON does not need canonicalization since multiple 
> forms are not allowed.

Uh. Since ordering doesn't exist, you'd have an interesting time making 
that argument to someone writing a standard for digitally signing JSON. 
With no canonical order, there's no standard byte stream. Similarly for 
spaces and CR/LF variations.

> -          XML has namespaces, JSON does not.

Win for JSON.

Also: JSON has arrays, which XML does not (they can be simulated, 
though the choice of technique for simulation may restrict things like 
nested arrays). JSON objects inside arrays have position, but no name 
(if the array is inside an object, then the name could be mapped from 
the keyname for the array member); JSON arrays inside arrays inside an 
object are somewhat more of a challenge.

Once you enter the world of DTD or schema, versus json-schema, there 
are additional capability distinctions. I'm not clear on what's 
important about this list of differences. *Is* it capabilities? 
Appearance? Something else? If we include concepts from DTD, XML has 
ID, lists, and so on (and see above on notations and entities).

XML has pointy brackets, JSON has curly and square ones. Whee.

Amy!
-- 
Amelia A. Lewis                    amyzing {at} talsever.com
The Bible contains six admonishments to homosexuals and three hundred 
sixty-two admonishments to heterosexuals.  That doesn't mean that God
doesn't love heterosexuals.  It's just that they need more supervision.


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS