←back to thread

Fixing JSON

(www.tbray.org)
139 points robin_reala | 1 comments | | HN request time: 0s | source
Show context
cies ◴[] No.12328149[source]
JSON is not optimized to be written by humans (I'd argue even JS is not well optimized for that </joke>).

There are other formats for that, like YAML and TOML[1].

When JSON is needed for human-to-computer stuff, I'd say TOML is pretty much always a better choice. A common use case for TOML is config files. And I see a lot of config in JSON lately; this makes me sad. (Though not as sad as the config-in-XML thing the Java ecosystem suffered from.)

1: https://github.com/toml-lang/toml

replies(3): >>12328239 #>>12329007 #>>12329698 #
DCoder ◴[] No.12329698[source]
Counter-point: you can tell if the JSON you received is intact or was cut off, because it won't parse properly without the closing braces. You don't have that safety net with YAML or TOML.
replies(1): >>12330444 #
1. ymse ◴[] No.12330444[source]
That's a really good point. I opened an issue: https://github.com/toml-lang/toml/issues/429