James Clark on JSON vs. XML

, Apr 9, 2007

James Clark on JSON vs. XML:

It’s not surprising that XML is unappealing to a generation of programmers who are coming to it fresh, without making allowances for how it got to be this way.

I’m too old to be part of this generation, but the same can be said for a whole lot of technologies, including Java, J2EE, Web services … what may have been a good excuse for their warts when they were new is often not convincing anymore today.

Another nice quote:

A range of powerful supporting technologies have been developed for XML. Naturally I have a fondness for the ones that I had a role in developing: XPath, XSLT, RELAX NG. I also can see a lot of value in XPath2, XSLT2 and XQuery. On some days, if I’m in a particularly good mood and I try really hard, I can see value in XSD.

The one thing I don’t happen to agree with (he writes this with regards to JSON):

Some important datatypes are missing. In particular, I think support for binary data (XSD base64Binary or hexBinary) is critical.

What’s the use case that can’t be solved by just referencing the binary content, preferably using some widely known way to identify things?

On April 10, 2007 12:08 AM, Gordon Weakliem said:

The one that pops to mind is encrypted content. Still, Base64 is just a special case of a string, and as you mentioned, for some things (especially large binary objects), you’ll probably be better off handing off a link and using HTTP to retrieve it.

On April 10, 2007 11:18 AM, Jacek said:

What’s one case when referencing doesn’t help? Packaging. The receiver endpoint may not be able/willing to resolve (arbitrary) URIs, or network may be unavailable at time of processing.

Gordon, check http://www.w3.org/TR/xop10/ for a way of optimizing the base64 away from XML.

On April 10, 2007 11:21 AM, Jacek said:

One thing I forgot - one can sometimes also use URIs from the data: scheme - base64 supported, any media type, data right there in the URI.

On April 12, 2007 2:26 AM, Dave Smith said:

Sometimes a fresh set of eyes is just the thing needed…