It seems that someone is always going around the Internet and making trivial things a competition. Thus, when Twitter and Foursquare both made moves to remove XML support from their APIs, millions of web developers rejoiced. Why such jubilation? Is there really a need to celebrate such a trivial, and logical, move? Norman Walsh and James Clark really covered the bases on this one, so I’ll spare the more intrinsic details that you can find at their blogs here, and here, respectively. Instead, let’s sit back and take a look at the problem with the bickering between the JSON and XML camps.
XML, like all of us, has less than perfect parents (except my children – they have one perfect parent [not me]). As James Clark points out, XML’s founders all had different visions for XML. Although one parent may have desired it for the glitz and glamor of the rising Internet superstar, another saw XML as a game changer in the unstructured data world. The non-web parent won out, and thus XML is not as strong as it could be for web specific functions. JSON, however, is the child of a web language and is bred from birth to handle data transfers across the web.
James, Norman, nor I can find fault in the argument that JSON is clearly superior to XML for most, if not all, web implementations. However, I think we all would be quick to point out that JSON is NOT a viable alternative to XML for a large percentage of non-web implementations. Sure, we can debate about whether or not we like XML over JSON or vice versa, but this is really an apples and oranges thing. Both fruit. Both edible. Both can be used in a fruit smoothie. But sometimes we’d much rather have one over the other depending on what we’re doing.
If you insist on calling it a "victory", then fine. But, in reality, there is a proper place for XML and JSON, and they’re not always the same.