3 ms·
> For example, let's imagine a notation to describe a chess party: In that example XML is missing the XML declaration. Furthermore, JSON doesn't require a type
by geezerjay 8y ago
> For example, let's imagine a notation to describe a chess party:
In that example XML is missing the XML declaration. Furthermore, JSON doesn't require a type field. That skews the comparison quite a bit.
Furthermore, the amount od symbols is irrelevant. Otherwise brainfuck would be considered exemplar wrt clarity.
> Also note that XML includes the element name, while with JSON we are supposed to know the object structure.
Exactly, that's another way JSON is simpler than XML as it requires no boilerplate code to convey structure.
That is particularly obvious in the sort of application covered in this discussion.
- Mikhail_Edoshin 8y agoXML declaration is optional (in 1.0, which everybody uses). My point was not that JSON is longer; JSON is noisier. XML in this example is longer, but easier to read because it has more content and less visual and cognitive overhead to convey the same structure (plus extra: element name). Some structural symbols are necessary, of course; we cannot just write "whitee4blacke5" (we can, in fact, it's parseable), but JSON uses more than XML. XML element names are not boilerplate, they're type names. Maybe configs do not need types, but who knows; maybe they do. Types are there for a reason. E.g. if users write configs, it would be totally cool to verify they're at least syntactically correct before using them. With JSON there's no standard way to do this; with XML there is. (And users write configs all the time; I, for example, being a user of Make and Apache routinely write Makefiles and .htaccess files.)