News for hackers. Stuff that matters.
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).