4 ms·
And advantage of XML is the ability to easily get substructures out of the data using XPath, and/or use XSLT to transform the XML directly to XHTML. So if you e
by jimfl 17y ago
And advantage of XML is the ability to easily get substructures out of the data using XPath, and/or use XSLT to transform the XML directly to XHTML. So if you expect API users to be doing any filtering of the requested data on the fly at the client side, XML may be preferred.
Another rule of thumb is that the deeper the nesting of complex data structures, the easier XML will be to manipulte. With XPath I can quickly get a list of all the foo/bar/baz where haha=true, whereas with JSON I would have to have three nested loops to extract that data.