Hacker News reacts to JSON5 (2012)
news.ycombinator.com
news.ycombinator.com
I do have a few gripes though. I think allowing so many weird Unicode characters as whitespace was a bad choice. JSON5's reliance on Unicode character classes in general both makes it harder to write a parser and introduces compatibility concerns as different parsers will parse files differently based on which version of Unicode they use. But all in all, JSON5 is pretty nice.
In fact, I recently wrote my own parser for it: https://github.com/mortie/json5cpp.
What backwards compatibility are you referring to? It seems like you actually are sacrificing BC, as the JSON5 file won't be readable by older versions of your software (that doesn't use a JSON5 parser yet).
Backwards compatibility: New versions of the software can use the files from old versions.
Forwards compatibility: Old versions of the software can use the files from new versions.
If you switch from JSON to JSON5, the new version can use the config file from an old version. If you switch from JSON to TOML, your users have to create a new config file, or you will have to support both JSON and TOML.
Meanwhile u/aseemk gets to have the last laugh. In _hacker spirit_ he went and did the thing and now JSON5 "ranks in the top 0.1% of the most depended-upon packages on npm." Pretty good for an "abmonination!"
It might seem like unwarranted "nerd fury" from the perspective of what JSON5 has become, but at the time it was presented as (and naively believed to be) a better JSON in every way. Apparently the seeming "fury" was actually productive input.
I think there’s a lesson in here about marketing. This wouldn’t have been adopted if it weren’t called JSON.
I love that everyone said “don’t call it JSON!” when JavaScript itself pulled the same damn trick vs Java.
Would you think criticism of TOML for having comments would be "right on the money"? No? Then why do you think differently for JSON5?
What's your definition of "extremely popular"?
I believe SQLite "uses" json5 in the sense that one of its important customers asked for json5 ingestion, and json5 was supported only for input in the spirit of the robustness principle.
From the horse's mouth.
"The important point to keep in mind is that SQLite will read JSON5, but it never writes it. The JSON that SQLite generates is canonical JSON that is fully compliant with the original JSON spec."
https://news.ycombinator.com/item?id=35962213
If your definition of success is accepting an extension because an important customer asked for an extension, so be it.
In the meantime, are you sure you want to compare plain old JSON with the mess that's JSON5? Because projects such as SQLite explicitly refuse to support JSON5, and apparently their decisions pass off as the definition of success.
> and millions of downloads
Are you sure you want to use that as a success metric?
Also reminds me of some comments on the Nuitka Python compiler ("completely misguided"), Vlang, and multiple other projects. Some projects against conventional wisdom, but for others I'm not sure why they elicit such nerd rage.
I do see that a few years later he tooted his own horn:
https://aseemk.substack.com/p/ignore-the-f-ing-haters-json5
Interestingly enough, that response received more upvotes on HN than his original post
I guess the lesson is: avoid the opinion of popularity-based social media, such as Reddit, HN, Twitter, etc. 90% is people trying to outsmart each other with their drive by criticism for karma.
In fact, in general, just ignore pretty much anyone's opinion if you are creating something, whether it's a personal project, a work of art or any other creative endeavour. Vision is a solitary process; the vast majority lack vision at all, and pretty much no one shares YOUR vision.
Given that, I might switch to jsonnet. It seems to have better support, and while it is a lot more complex and includes some crazy anti-features (automatic type coercion - guys it's 2023), sometimes those features do come in handy and it seems to be mostly well designed.
The only big issue I've found with it so far is that it also has no schema support.
Flat is Better than Nested, says Python.
JSON is great for machine to machine stuff that a human might incidentally modify or debug. For anything else, there's other formats. Although multiline strings are nice to have.
Seems like a decent approach might be the robustness principle. Accept it, and if support becomes really common, them start writing it?
This lacks unquoted string values though. I'm not sure why being a subset of ecmascript matters aside from just consistency for the programmer?
The more recent post from the author a year ago and discussion: https://news.ycombinator.com/item?id=32379245