4 ms·
An XML document without a schema is strictly worse than JSON without a schema. JSON with a schema is strictly better than XML with a schema. XML structure does
by incrudible 3y ago
An XML document without a schema is strictly worse than JSON without a schema. JSON with a schema is strictly better than XML with a schema. XML structure does not map neatly into the data types you actually want to use. You do not want to use a tree of things with string attributes, all over your code. If you do have a schema, the first thing you will want to do is turn your data into native language data types. After that point, the serialization method does not matter anymore, and XML would have just be slower. Designing a schema for XML is also more tedious than for JSON.
- mcculley 3y agoI enjoy JSON for internal stuff and where it does not matter that JSON is not very expressive. JSON Schema is a poor substitute for a proper schema. For anything where I am interfacing with another person or team, I send them a DTD or XSD, which documents the attributes and does not have nonsense like confusing integers and floating point values. For quick and dirty, I agree about JSON. For serious data interchange, I use XML.
- bayindirh 3y ago> XML structure does not map neatly into the data types you actually want to use. > After that point, the serialization method does not matter anymore, and XML would have just be slower. Considering I have mapped 3D objects to (a lot of) C++ objects containing thousands of facets under 12ms incl. parsing, sanity checking, object creation, initialization and cross linking of said objects on last decade's hardware, I disagree with that sentiment. Regarding your first point, even without a schema, an XML shows its structure and what it expects. So JSON feels its hacked together when compared to XML in terms of structure and expressiveness. It's fine for serializing dark data where people won't see, but if eyes need to inspect it XML is way way more expressive by nature. Heck, you even need to hack JSON for comments. C'mon :)
- mcculley 3y ago> JSON with a schema is strictly better than XML with a schema. I am baffled by this assertion. XML Schema (XSD) is much more expressive than JSON Schema.
- incrudible 3y agoThat is a bug, not a feature.
- mcculley 3y agoNot to me. I have lots of data exchanging going on where the format is expressed well in XSD and in JSON Schema it is expressed through documentation, code, and a history of angry emails.
- incrudible 3y agoIf it can't be expressed as a JSON schema, it's a bad idea. If it can be expressed by a JSON schema, it may be a good idea.
- mcculley 3y agoThis does not match my experience. Can you provide some clear explanation or examples of why having less power to express a schema is desirable?
- incrudible 3y agoParalysis of choice.
- mcculley 3y agoThis remains an unconvincing argument.
- deleted 3y ago[deleted]
- incrudible 3y agoNot everybody needs convincing. JSON already won.