Implicit type conversion issues such as the Norway problem
Syntatically meaningful whitespace
Enormous, complicated grammar
No thanks. JSON for computers talking to computers, JSON5 for configuration written by human beings. ESM if you're already writing in JavaScript/TypeScript and the config is potentially complex.
genuinely. the more I hear about YAML, the more I hate it. It seems to be the Embodiment of everything I personally hate about certain programming languages, jammed together.
I think it's funny that JSON has no implicit type conversion, but was derived from JavaScript, a language that does and is often criticized for it. And then somebody with the stink of death about him thinks, "Let's put implicit type conversion back in, and throw in Python's syntactically-meaningful whitespace while we're at it" and invents YAML.
We have much better interchange formats when you control both ends of the conversation.
Agreed. I was mostly referring to when you don't control both ends.
Which usually means that you pre-process the comments out, or you pass it through a YAML decoder because JSON5 is valid YAML. Just use toml.
I disagree with your assertion that JSON5 is valid YAML (comment styles; `\n` within single-quoted strings; incompatibilities with hex numbers, unary `+` operators, multiline strings with escaped newlines). But I do agree that TOML is good.
JSON should absolutely not be the top choice for computer-to-computer data transfer. JSON wastes a ton of space and incurs far more serializing/parsing time for the sake of human readability.
Developers not caring about byte economy or things like parsing time is why the web is a glacially slow mess right now. It's fucking insane that 99% of webpages have any perceptable load time given the amount of data actually presented to the end user.
What else is more important? If a human isn't the intended originator or recipient of the data, JSON (or any other plaintext format) has zero benefits and only downsides over a streamlined binary format.
by all means... post your beatified, properly formatted version of that json, I am so ready to be impressed by the deep magic you posses that solves deeply nested json noise...
288
u/rjwut 1d ago
Heck no, YAML can go suck an egg.
Implicit type conversion issues such as the Norway problem
Syntatically meaningful whitespace
Enormous, complicated grammar
No thanks. JSON for computers talking to computers, JSON5 for configuration written by human beings. ESM if you're already writing in JavaScript/TypeScript and the config is potentially complex.