5 ms·
Right, but you inevitably end up with boilerplate "massage" code around your data anyway. Case in point: dates, any number that isn't just a number e.g. currenc
by mstade 9y ago
Right, but you inevitably end up with boilerplate "massage" code around your data anyway. Case in point: dates, any number that isn't just a number e.g. currencies or big numbers, URLs, file paths, hex, hashes. Basically any type that carries any kind of semantics beyond array, object, string, number, or null will require this boilerplate, only that your data format has no way of describing them except for out-of-band specs, if you want to call them such.
At least XML has schemas, and even if all you're doing is deserializing everything into JsonML like objects you're still better off because you'll have in-band metadata to point you in the right direction.
- mstade 9y agoAlso, for what it's worth, your point is exactly why I mentioned E4X. Sure wasn't a panacea, but it had some things going for it.
- Marazan 9y agoE4X was exceedingly great. Loved it.
- spc476 9y agoCBOR [1] allows the semantic tagging of data values and makes a distinction between binary blobs (a collection of 8-bit values) and text (which is defined as UTF-8). [1] RFC-7049. Also checkout http://cbor.io/ http://cbor.io/
- sacheendra 9y agoIMHO the boilerplate code is much easier to read than understanding the nuances of XML if I have to read a document. {"type":"currency", "unit":"euro", "amount": 10} feels easier to understand than <currency unit="euro">10</currency>
- DougWebb 9y agoHow about: <rec type="currency" unit="euro" amount="10" /> I don't think your problem is with the syntax, necessarily. It seems more like you prefer name/value pairs over semantic markup.
- mindcrime 9y agoMaybe it's just conditioning, but I find the latter example easier to read and understand. In fact, I'd say that - in general - I find XML better in terms of human readability than JSON. I guess it just goes to show that we all see certain things differently. shrug
- abritinthebay 9y agoI think that's totally reasonable - because it was after all one of the goals of XML. That is, to be human readable. There is a difference however between readable + parsable vs parsable + easily dealt with. XML was not the latter. You have to do more work to traverse and handle XML inside your application than you do JSON, and most of the (reasonable) reasons for this are due to features that most cases don't need. JSON makes the common case easy, XML doesn't.
- moolcool 9y agoThe biggest problem with XML is how easy it is to make a very bad schema, and how hard those can be to parse