upvote
XML is a great format for what it’s intended for.

XML is a markup language system. You typically have a document, and various parts of it can be marked up with metadata, to an arbitrary degree.

JSON is a data format. You typically have a fixed schema and things are located within it at known positions.

Both of these have use-cases where they are better than the other. For something like a web page, you want a markup language that you progressively render by stepping through the byte stream. For something like a config file, you want a data format where you can look up specific keys.

Generally speaking, if you’re thinking about parsing something by streaming its contents and reacting to what you see, that’s the kind of application where XML fits. But if you’re thinking about parsing something by loading it into memory and looking up keys, then that’s the kind of application where JSON fits.

reply
Check out EXI. It compresses the xml stream into a binary encoding and is quite small and fast:

https://www.w3.org/TR/exi/

reply
Only if you never use compression.
reply