|
|
|
|
|
by Jare
1408 days ago
|
|
I read and write json manually almost every day. I haven't bothered to insert json5 in our pipelines for various reasons, but I sure wish it was the default. The interesting question I think is, why do you think json is so used in that capacity despite not being meant for it? Why YAML, despite being so widespread, hasn't swept json away for those purposes? (let's for a moment ignore that YAML can go REALLY nuts, and think only of the simplest version of it) |
|
In a small file, semantic indentation is beautiful. In a large file where you have to scroll and scroll to find out where you are, it's a pain. And perhaps importantly - can't be autoformatted. Your IDE doesn't know what indentation level you intended, and without braces/brackets to tell it, it can't detect errors.
There's parsing automagic wackiness if you're not careful (the famous example: country abbreviation NO for Norway becomes FALSE).
The nice feature of references is almost never actually used in practice. An incorrect or circular reference can look fine but badly break things.
Yaml typing is application (and version) dependent so not really useful.
There's more, but basically JSON, though simpler and uglier, prevents all of those. You can, and pretty much have to, use an alternative 'safe YAML' parser, but even that doesn't solve some of the problems.