News for hackers. Stuff that matters.
Re:JSON5 – JSON for Humans by devjab on Monday December 09, 2024 @11:53AM (#42367873)
I think the opinionated approach is what made json “win” the format battle more than anything else. If you’ve been around enterprise in the early 00’s you’ll know the horror that XML became when people weren’t using it in any sane manner. Which a lot of people simply weren’t, for whatever reason. Now this is anecdotal but over the decades I’ve never had issues parsing json, and I largely attribute its strictness to that. Yes I suppose you could abuse it, but I wouldn’t have to parse your nonsense, which couldn’t be said for XML.

I don’t have anything against XML by the way, it was purely horrible to work with because people were using it in so many weird ways. Personally I prefer toml, but I guess we all have our preferences.

Re:JSON5 – JSON for Humans by int_19h on Monday December 09, 2024 @12:13PM (#42368039)
What made JSON win was the ease of use from JS (= frontend).
Re:JSON5 – JSON for Humans by hn_throwaway_99 on Monday December 09, 2024 @02:10PM (#42369374)
100%

JSON wasn't some magical, made-on-the-fly format that makes Crockford some kind of genius. It was simply the standard Javascript object literal notation with some added constraints. I think some of those constraints make sense (i.e. are there any other languages that support both single and double quotes for string literals?), but funnily enough, some of the biggest issues with JSON interoperability is it is very underspecified in the areas that matter, such as the type and width of numeric literals, what to do in some edge cases like duplicate keys, etc. Just did a quick search, and here is a post that outlines some of the real security risks this underspecification leads to: https://bishopfox.com/blog/json-interoperability-vulnerabili...

Re:JSON5 – JSON for Humans by Aloisius on Monday December 09, 2024 @09:49PM (#42373207)
> are there any other languages that support both single and double quotes for string literals?

Yes, quite a few like Python, PHP, Fortran, COBOL, Lua, R, Ruby, Perl, Bourne Shell, Dart, Groovy, etc.

Though some only interpolate with one or the other.

Re:JSON5 – JSON for Humans by devjab on Monday December 09, 2024 @02:50PM (#42369818)
Back in the early 00’s json wasn’t winning because it was derived from JavaScript, it was winning because it was the “easiest to use” standard on web services.

Sure it’s derived from JavaScript and it plays a major part in frontend development today. It was really the other way around though, when Ajax picked up people started realising that they could use json to make frontends work with “just” html and JavaScript.