Robin Berjon

XML versus JSON

It's Meh Again

A common preoccupation of philosophy is the study of fallacies. I'm unsure how it became this common, I can only presume that scaring up a shared definition of what the truth is has over time proven to be such a dastardly headache-inducing activity that coming up with a list of every way in which one can be wrong might have seemed easier — if only because not only can you drink at the same time, but being drunk is actually a superior methodological approach to producing what is indeed a very, very long list. Or maybe it is because after a few years' worth of honest debate, the young, starry-eyed philosopher grows tired of having his buttocks handed over to him in separate bags by less honourable wranglers. Schopenhauer's Art of Being Right certainly lends credence to the latter.

In a recent blog post, Manu Sporny essentially makes the claim that JSON is better than XML because SOAP is dreadful. That's like saying that receiving a kick in the head is better than eating because nato or andouillettes are crimes against the palate. Step one: take the worst instance of something. Step two: generalise its properties to the whole class. Step three: declare victory, truth, and beauty to be forever yours. Yup, there's an informal fallacy for that.

Am I being caricatural of Manu's position and unfair in my characterisation? Yes? Really? Good. Because that's the only way this non-debate can be reheated enough to matter.

More to the gist of the matter, Manu further claims that XML experts are missing out on the fact that JSON is simpler, and that a number of online APIs dropping support for XML is big news. I fail to see how that's the case. Having spoken numerous times at XML conferences about the virtues of JSON and its surrounding ecosystem, I can only say that it is generally well received in the XML community and has been for a while by now.

In fact I'm going to stick my head out there and claim that anyone who's used XML-RPC knows that there's a problem in using XML for the sort of data that JSON captures. For those even younger than I, XML-RPC came out in 1998. Pinning down the exact date of its death would be difficult as it usually is with technology, but let us say that it most certainly isn't alive, and hasn't been for a while. In other words, this is hardly new information.

Yes, there are some vendors who've been selling solutions labelled "Web Services" for a long while that have a limited relationship to the Web and are generally a disservice to whoever ends up needing to use them. Yes, they will keep selling them. And yes, some people will listen. Well — people use Oracle databases and MS Word when they don't need to, is anyone surprised? Is this newsworthy?

If you need a generic syntax for documents, XML rocks like nothing else we have on hand. If you need the ability to orthogonally layer all manners of decorative data inside the same data representation, then again XML will be very good. Most web services don't match either description, and that's fine. That's why it wouldn't cross my mind to use XML for them. Frankly, I thought that was a settled debate. 1

That's why this debate is really a "Meh Moment". The only thing that surprises me is that apparently Twitter, Foursquare, or Digital Bazaar only noticed that just now. I guess it might be because they weren't around yet when the rest of the world found out. Beyond even web APIs, XML was largely dropped from the major parts that it had occupied in Web development several years ago. There was a time when the likes of Cocoon and AxKit were the bright future. When the "X" in AJAX was for XML. But that's been long over. So what's the hubbub here? If it really is that some Web companies are dropping support for XML in their APIs now, all I have to say is Dudes! What were you thinking before?

So indeed there is no XML versus JSON debate. There is, however, a much more interesting related topic: is there value in building a better bridge between XML and the primary continent of Web technology? If so, what specific areas would you like to see bridged first? Forgetting what you hate about either side, forgetting the politics of changing this or that technology to make it work, what would you do first?