28 ms·
Json5, although not widely adopted. Has // comments and /* block comments. It also allows additional trailing , in lists. Something I hate but is a great featu
by mianos 3y ago
Json5, although not widely adopted. Has // comments and /* block comments.
It also allows additional trailing , in lists. Something I hate but is a great feature if you use a macro system on top of it. (Like jinja2).
- jeroenhd 3y agoJSON5 does, but most software just does plain and simple JSON. I haven't seen it used outside some Javascript webdev environments. The JSON5 docs also seem to be specifically targeting Javascript development. If you're sticking to certain variants, you may as well use YAML, which supports JSON notation, as well as comments and various other improvements.
- mianos 3y agoIf you use python, there is an excellent json5 module. But true, it may not be as well supported by other languages. I am not sure I may as well be using yaml. I don't like it for the multiple reasons in the OP and this thread. If you are using python, I have found it to be quite easy to support both json5 and yaml, as well as converting between them for people who feel strongly about yaml. Not trivial but low effort.
- kortex 3y agoI've gotten bit by trailing commas enough times (both manual edits and writing generators) that I absolutely expect any reasonable syntax to tolerate them. It's just so much easier and more consistent to tolerate them.
- jen20 3y agoAs importantly, it reduces the noise in diffs when an item is added to a sequence.
- masklinn 3y agoYou can use prefix separators for that. Haskell-style.
- panick21_ 3y agoThat's what Clojure got right. Comma is whitespace. When you print a datastructure, it has commas. But they don't effect reading of that structure. Its brilliant and practical.
- themerone 3y agoThis is why I switched to leading commas.