4 ms·
Sometimes I just don't really see it as a competition. For my research work often XML is a markup, which JSON is not. If I want to qualitative code a text, this
by _glass 4y ago
Sometimes I just don't really see it as a competition. For my research work often XML is a markup, which JSON is not. If I want to qualitative code a text, this is perfectly doable by hand:
<note>
<paragraph>This is a <code vibe="positive">remarkable</code> text.
</paragraph>
</note>
If you do it in JSON, it is not really readable anymore, and I would have to write GUI for the input, e.g.,
{ "note":
{ "paragraph":
[ "This is a ",
{ "code": [ { "vibe": "positive" }, "remarkable" ] },
"text."
]
}
}
- nordsieck 4y agoIMO, you made the JSON unreadable with all the extra whitespace that you didn't add to the XML. {"note": {"paragraph": ["This is a ", {"code": [{"vibe":"positive"}, "remarkable"]}, "text."] } } Also, in this particular case I think the child/property dichotomy works in the favor of XML, but typically I find it to be more of a liability than an asset.
- quectophoton 4y agoIf you use arrays instead of objects, it becomes JsonML[1]: ["note", ["paragraph", "This is a ", ["code", {"vibe": "positive"}, "remarkable"], " text."]] [1]: https://en.wikipedia.org/wiki/JsonML https://en.wikipedia.org/wiki/JsonML This is also why I find Mithril.js so pleasant to use without JSX, because it's basically JsonML.
- sph 4y agoUse parens and you have S-expressions. No need for all that noise. (note (paragraph "This is a " (code (:vibe . "positive") "remarkable") " text.")) Lisp was invented in 1958 and we routinely rediscover it, and reimplement it badly.
- quectophoton 4y agoYeah, S-expressions are way more pleasant to write. With the benefit of a lot of hindsight, S-expressions seem like a superior choice for writing web applications (instead of HTML + JavaScript + some JS framework that writes HTML again (regardless of DOM vs Virtual DOM)). Even though I prefer dialects like Fennel for programming rather than Common Lisp (I'd probably be fine with Clojure and Janet as well, but I haven't tried them), I wouldn't mind any dialect if that means I could use S-expressions instead of HTML+JS, assuming the amount of effort put into sandboxing that approach were as much as the effort that has been put into the current approach.
- _glass 4y agoI love Lisp, but the quotes, and the structure ... Markup really shines here. Sorry. Same with JsonML, even though I never heard of it before, and will have a look because it just sounds so interesting.
- zvr 4y agoHow do you parse such JSON? A "note" contains a "paragraph" object, which is an array of...? Strings, or objects where there are keys, but the values are arrays of...?