In short, JSON is a decent interop option, particularly for javascript. If that's enough, then what is the point of XML?
For more complex data, json is less beneficial in my mind. XML may be less "efficient", but I rarely came across this problem - but force naming of elements in xml means that it is often easy to debug - this is especially true for projects spanning multiple organizations - B2B interop, say. XML has the best equipment in the form of XSLT, XSD, integration into many languages ββ(native XML VB.NET, say LINQ to XML), and it is more naturally βopenβ - it is easier to expand XML with a new element without breaking the old scheme, whereas the list in json contains unnamed elements, which makes functional collisions more likely. Of course, you can get around all these things in JSON, but this requires forethought and planning. Finally, although most languages ββhave decent XML support, javascript in particular does not, creating XML is painful if you do not use several helper functions (the DOM does not get any design prizes here).
Shortly speaking; I use XML for data exchange and probably longer-term complex APIs, and json specifically to facilitate working with a client server where a strict API is not needed, and therefore xml imperfect OO compliance and a bit heavier weight transfer is drag and drop does not match any of the benefits. If you intend to perform a small AJAX update, JSON works fine and avoids the OO / XML impedance mismatch (and less serialization means icing on the cake).
I have never worked on a large enough application where the JSON bandwidth savings had an impact, but if you are Google or Microsoft, I am sure there is also a significant benefit (and you probably need to spend a ton of planning and forethought, as any API that you release will quickly become addicted.)
source share