JSON is a designation for serializing objects. This is his focus and purpose. XML is intended to define markup languages, but I donβt like it if people clog this fact as if it cannot be used for data. I find XML very suitable for representing many data structures. However, XML is rather universal, and this leads to some overhead in terms of specification, notation, and tool size.
First of all, find out what you need. Is it necessary to transfer data in a more general sense or is it enough to bypass objects? Will you require things like namespaces? Choose a technology that does what you need, but nothing more. But remember the future expansion.
Secondly, consider the tools. XML has great support in almost any language. There are methods for in-memory representation (DOM), object binding (JAXB in Java), parsing (SAX) ... Does JSON support this support in your target environment? JSON, on the other hand, is extremely user-friendly in conjunction with JavaScript.
I believe that you can do what you need, regardless of the choice of technology, and in each of the options there is a place for optimization. But there is one last thought: maybe you do not need to choose. Sometimes it is very simple to enable serialization of data as JSON or XML. As a Java programmer, this is the only example I can come up with, but in JAX-WS there are methods for retrieving data from web services like XML, JSON, or perhaps even other formats with minimal code adaptation.
G_h
source share