News for hackers. Stuff that matters.
Re:I wish JSON5 was more popular by 8chanAnon on Saturday June 17, 2023 @02:11AM (#36367752)
Imagine thinking that the JSON format was ever intended for human readibility. If it were, then whitespace would have been made mandatory. HTML is insufferable for the same reason. When whitespace is optional then it will soon be the case that only computers will understand it.

Create your own format that is easy to parse. Is there an overwhelming reason to standardize on something that doesn't work for you?

Re:I wish JSON5 was more popular by sam_lowry_ on Saturday June 17, 2023 @03:02AM (#36367993)
The point of JSON is that it is a subset of JavaScript and you could pass it to `eval`.
Re:I wish JSON5 was more popular by beardyw on Saturday June 17, 2023 @05:25AM (#36368640)
Yes, it is mighty convenient even if JSON is generated by something else to just add a let X = in front and call it js.
Re:I wish JSON5 was more popular by dzsekijo on Saturday June 17, 2023 @06:47AM (#36369006)
I don't see why to stick to being a JavaScript subset. Yes, in the olden days it was practical with JSON that there is no need to write a dedicated parser, just pass the data to eval(). Nowadays you should not pass anything to eval, apart from metaprogramming purposes (in which case the input is fully in control of the code).
Re:I wish JSON5 was more popular by Klonoar on Saturday June 17, 2023 @02:16AM (#36367770)
I've come around to just using TOML wherever possible.

It is not perfect, not by any means. But it really does hit a sweet spot of things and mostly stops you from shooting yourself in the foot.

Re:I wish JSON5 was more popular by hughesjj on Saturday June 17, 2023 @02:58AM (#36367971)
> And while we’re at it, stop polluting my projects root directory! Can’t we all agree on a .meta directory for finding configuration files?

Yes, but to nitpick how about `.config` instead? If only because it's reminiscent of the default XDG_CONFIG_HOME relative location

Re:I wish JSON5 was more popular by donatj on Saturday June 17, 2023 @03:05AM (#36368003)
JSON5 starts out with some features I can absolutely get behind

- Arrays may have a single trailing comma.

- Strings may be single quoted.

- Single and multi-line comments are allowed.

Then starts falling apart implementing things that aren’t even legal in JavaScript. Calling itself JSON-anything and not being literally compatible with JavaScript notation is just… an unforgivable cardinal sin.

Re:I wish JSON5 was more popular by SAI_Peregrinus on Saturday June 17, 2023 @11:29AM (#36371066)
Yeah, I'd rather just use RON and at least have good mapping to the Serde data model. It's just as usable for humans, and everything it implements is legal in Rust so calling itself Rusty Object Notation is accurate. Sadly there aren't bindings for other languages, so using it from C++ or such isn't that simple.
Re:I wish JSON5 was more popular by dzsekijo on Saturday June 17, 2023 @06:46AM (#36369000)
What I miss from JSON5 is a dedicated date/time type (TOML eg. does have it!). I understand that this would be a step beyond mere syntax sugaring, but I'd still prefer this trade off.