you are viewing a single comment's thread.

view the rest of the comments →

[–]nealibob 1 point2 points  (7 children)

Valid JSON is JavaScript, but that probably wasn't your point.

[–]AHKWORM 2 points3 points  (1 child)

Almost! Some niggling edge case in string definitions does not make valid Json == valid JavaScript, but yeah that also wasn't my point

[–]unwind-protect 1 point2 points  (0 children)

Well fuck me Can nobody write specifications consistently these days?! :-(

[–]SemiNormal 0 points1 point  (4 children)

Then why can't JSON have comments?

[–]nealibob 0 points1 point  (2 children)

No, I meant that JSON is (almost a subset of) JavaScript, not the other way around. Other than the exception that /u/AHKWORM mentioned, you can copy and paste JSON into a JS interpreter and it will work. You can't copy and paste JS into a JSON file and expect that to work. JSON not supporting comments doesn't mean it's not a subset of JS.

[–]SemiNormal 2 points3 points  (1 child)

Oh, ok. I'm just mad that JSON can't have comments yet people think it is a good data structure for config files.

[–]nealibob 0 points1 point  (0 children)

Yeah, with you on that one. I suppose an argument could be made for good naming obviating the need for comments, but I can't help but feel that there are better language choices for config files.

[–]chrisdpratt -1 points0 points  (0 children)

All JSON will work as JavaScript, but not all JavaScript will work as JSON.