Comment #6 on issue 616 by ben.combee: JSON.parse doesn't accept strings contain new lines
http://code.google.com/p/v8/issues/detail?id=616

Just to clarify: the problem with JSON.parse('{ "key": "a\nb" }'); is that this a JS code, so the JS parser encodes the \n into a NL character when it stores the string in memory. Then, when JSON.parse is called on it, it fails because it sees the raw character.

Does this mean that if you've pulled JSON in from a file or a AJAX request directly into a JS strings, that using \n is OK... it's just when you've got a string literal in C or JS source code that you need to double escape?

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to