Live data from Hacker News

Ignore the haters, and other lessons learned from creating JSON5

aseemk.substack.com

121–130 of 211 posts

Re: Ignore the haters, and other lessons learned from creating JSON5

#123

Earlier quoted context omitted.

The first two sentences of the text on http://json.org are "JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write." It's a primary goal of JSON, it's fair to question whether it's successful at it. Personally, I'd much rather write TOML or S expressions. I don't like YAML at all, the whitespace sensitivity drives me nuts.

Douglas Crockford usually says he discovered JSON, and subsequently named it and wrote a specification, and I think this precludes suggesting it had design goals, because it wasn't an invention. More broadly, I also think this understanding of JSON's origins absolves the discoverers of its limitations, and opens the door to talking about improvements and variations. Notwithstanding which, I too would prefer to interc…

I don't follow your discovery/goal-less-ness argument. Why couldn't one of the things present in his discovery be readability?

+1 on those S-expressions.

Re: Ignore the haters, and other lessons learned from creating JSON5

#124
post #11

Whenever I need to use JSON in my projects I always check if I can use JSON5 instead. It really makes a difference to have a more user friendly format. My only gripe is when I use Python, the official JSON5 module is much, much slower than Python's JSON parser. I frequently end up translating the development JSON5 files to JSON files that go into the final runtime because of this.

As much as the spec for this looks like a list of features that one hardly believes are absent from the original JSON, this just makes things worse as you now have to check which type you're working with, as if there are already not enough places for things to break.

https://xkcd.com/927/

Re: Ignore the haters, and other lessons learned from creating JSON5

#125

Earlier quoted context omitted.

This seems like making a mountain out of a molehill. > Extending the syntax is undoing all the communal work JSON5 takes stuff from ES5.1 and adds it to JSON, and ES5 is backwards-compatible with older JS. This means it's fairly trivial to convert JSON5 to JSON (literally 13 lines: https://gist.github.com/iddan/3d34b12f6b22c30a8a07c149b3175e... ). And ES5.1 itself was the product of communal work. > encroaching on gr…

> JSON5 takes stuff from ES5.1 and adds it to JSON, and ES5 is backwards-compatible with older JS. This means it's fairly trivial to convert JSON5 to JSON (literally 13 lines). This take is disingenuous and horribly uninformed and very shortsighted. Not every parser out there is JavaScript eval(). Some people actually had to write and maintain a parser in whatever programming language they have to work with. In the p…

I agree with your point here (but I'm not the GP). The main thrust of the article is about finding product/market fit, and it could be said here that the market isn't the parser writers, who would be disrupted, but the developers who want a JSON format with better ergonomics.

> And if I happen to be consuming an API I don't control which for God knows what reason decided to move to json5

And such a decision might be the API maintainers not understanding their users.

Re: Ignore the haters, and other lessons learned from creating JSON5

#126

The only 2 things I'd like to add in JSON are trailing commas and comments, and this is already supported in most JSON configs (.eslintrc, .babelrc, ..), it's called JSONC I believe

To each their own, but I find mandatory quoted keys a pain in the ass, and once you change those three things you're basically at JSON5.

Re: Ignore the haters, and other lessons learned from creating JSON5

#127

Earlier quoted context omitted.

I think you will find that a great diversity of minds are attracted to this site, and for reasons you may not have considered. Curiosity is a giddy thing, and it is a fundamental part of what draws me here. If you read this site and see only the occasional jerk rather than the experience-driven insights, that is your misfortune. Maybe instagram is your thing. I hear they have a lot of cat pictures.

What makes you think the jerks are only occasional?

Speaking as a reconstructed jerk, I have worked hard at not being one but sometimes it slips through the net.

Re: Ignore the haters, and other lessons learned from creating JSON5

#128
post #101

Earlier quoted context omitted.

The first two sentences of the text on http://json.org are "JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write." It's a primary goal of JSON, it's fair to question whether it's successful at it. Personally, I'd much rather write TOML or S expressions. I don't like YAML at all, the whitespace sensitivity drives me nuts.

I don't get how anyone uses TOML. YAML is whitespace sensitive but it's python rules and quite sensible. TOML is just plain unreadable to me when I have to figure out what I'm looking at: I convert it to YAML to both read and write it when I have to add new lists/maps.

You are not alone, I find TOML awful to use and hate when I get forced into it.

Give me YAML or JSON at least they make sense.

Re: Ignore the haters, and other lessons learned from creating JSON5

#129

Earlier quoted context omitted.

> This means it's fairly trivial to convert JSON5 to JSON (literally 13 lines: https://gist.github.com/iddan/3d34b12f6b22c30a8a07c149b3175e... ). Did you paste the correct link? This just plumbs together an existing JSON 5 parser with a JSON 4 serializer. How many lines does this take without importing a library the solves this for you?

JSON5 parse constructs a Javascript object, which can in turn be serialized by JSON 4 into valid plain JSON string. That's not an invalid way of converting the two objects. JSON.stringify is part of the standard JS spec: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... JSON5.parse() is part of JSON5's API: https://json5.org/#json5parse So any project that includes both standard JS and JSON5 could liter…

> So any project that includes both standard JS and JSON5 could literally copy and paste this code

is not a convincing reply to

> so parsers already exist in every language

Re: Ignore the haters, and other lessons learned from creating JSON5

#130
post #68

Here's the old (2012) HN thread with the haters in it: https://news.ycombinator.com/item?id=4031699 . Happy to see an old (positive) comment of my own that I had forgotten about, which I think sums the whole thing up quite well. It still applies, so I'll repost it here: You know that something has gone very deeply wrong somewhere when people oppose your project because they are ideologically opposed to comments. In m…

https://hn.algolia.com/?dateRange=all&page=0&prefix=true&que...

Actually, I found this enlightening. It didn’t reduce the signal to noise ratio in any way.
Post reply on HN