News for hackers. Stuff that matters.
Re:JSON: The JavaScript subset that isn't by tomstuart on Sunday May 15, 2011 @12:21PM (#2550184)
Valid point, but not a great example. You get a syntax error in Safari's Web Inspector even if you type that JSON yourself (i.e. no Unicode funny business):

  > {"JSON":"rocks!"}
  SyntaxError: Parse error
Re:JSON: The JavaScript subset that isn't by gildas on Sunday May 15, 2011 @12:22PM (#2550185)
Right, you don't need "U+2028" character to reproduce the error. Why ? Because the parser handles {} as a block code, not as an object declaration.

Actually, the "good example" should be : var obj = {"JSON":"ro
cks!"}

Re:JSON: The JavaScript subset that isn't by judofyr on Sunday May 15, 2011 @12:28PM (#2550201)
Re:JSON: The JavaScript subset that isn't by tmcw on Sunday May 15, 2011 @12:29PM (#2550205)
Though, to his credit, in the little REPL that he shows, he typed ({"JSON":"rocks!"}), not {"JSON":"rocks!"} - the former is valid.
Re:JSON: The JavaScript subset that isn't by judofyr on Sunday May 15, 2011 @12:33PM (#2550214)
To tomstuart's credit, I fixed the post after he wrote that comment.

Meta: Right after I originally wrote this comment I saw that tomstuart answered too, so I decided to delete my comment. Well, it appears that so did Tom, and suddenly there were no replies here.

Re:JSON: The JavaScript subset that isn't by tomstuart on Sunday May 15, 2011 @12:46PM (#2550243)
HN feature request: compare-and-swap comment semantics.
Re:JSON: The JavaScript subset that isn't by nbpoole on Sunday May 15, 2011 @12:23PM (#2550186)
Indeed. You get the same error in Chrome and a slightly different one in Firefox. That isn't valid JavaScript on its own.
Re:JSON: The JavaScript subset that isn't by lautis on Sunday May 15, 2011 @01:33PM (#2550326)

  > {"JSON":"rocks!"}
I don't think this is such a good point. While the example is not a valid expression, it is a perfectly good JS value/statement, like (almost) all other JSON. Wikipedia might go a bit too far in saying that all JSON formatted text is legal JS code, but (IMHO) it still is a perfectly good subset.

The unicode part is a clear error and should be fixed.