http://seriot.ch/parsing_json.php
https://en.wikipedia.org/wiki/JSON#Data_portability_issues
XML has XSD and RELAX NG for more than 15 years now. https://json-schema.org/ is still a draft.
Re:XML is almost always misused
by Mikhail_Edoshin on Wednesday October 30, 2019 @05:03AM
(#21395752)
XML spec is longer than one page, granted, but it's about three times shorter than YAML spec. And XML spec describe not only the XML syntax, but also a basic form of validation (DTD), which include references. Basic XML has only five special symbols (<, >, ', ", and &) and can be parsed in linear time. (Namespaces complicate things somewhat.)
Re:XML is almost always misused
by jackcviers3 on Wednesday October 30, 2019 @08:47AM
(#21397076)
That's because json's spec isn't complete. It is predicated on the language interpreting it to be able to just eval the structure and work with the data [1]
For a non human-edited data storage or exchange that’s fine. Json is worse for human editable data though. Xml might not be the best alternative there but it beats json for things like small configs.
It’s not as simple as saying “everywhere xml is used, json would be a better choice”.
XML is a complete mess. Have you SEEN it's spec?
You can put JSONs spec in a single page. XMLs spec, not so much. Hell, most of the XML parsers don't support the spec, and the ones which do, historically have been riddled with security holes.
JSON over XML was simplicity over a crazy spec built by a bunch of companies all wanting to shove their own crazyness into it.