Choosing Between XML and JSON
May 19, 2014
In its article, “JSON vs XML and the Impact for Design Decisions,” GCN reminds us that, when it comes to choosing between XML and JSON, one solution does not fit all. Writer Michael C. Daconta has deep roots in XML, and admits a bias toward its use in IT architectures. However, even he admits that the newer format has its advantages, primarily in the area of efficiency. So, why keep a dinosaur like XML in the toolbox? The article points out:
There are at least four situations where XML may be better than JSON. To set the stage, it is important to remember that efficiency is not always the No. 1 priority. As Donald Knuth famously stated, ‘We should forget about small efficiencies, say about 97 percent of the time: premature optimization is the root of all evil.’
First, the ‘M’ in XML stands for Markup, and XML can be used to markup or ‘tag’ text documents, which is something JSON does not do.
Second, XML schema allows users to validate whether an XML document is correct before transmission. So if validation is important, than XML may be a better choice.
Third, XML allows extension of the elements in a document via techniques like substitution groups, the extension element, and the ‘any’ element.
Fourth, there is a plethora of tools and standards that augment XML like XSLT, XPath, XQuery and many more.
So, naturally, the answer to “which is better?” is “it depends.” Daconta notes that nearly every time he’s been called to a rescue a troubled IT environment, he’s found the problems are rooted in poor design choices. Companies can save a lot of trouble (and money) down the road if they take the time to properly analyze their environments, requirements, and use cases before making a choice.
Cynthia Murrell, May 19, 2014
Sponsored by ArnoldIT.com, developer of Augmentext