Comment #4 on issue 616 by LasseReichsteinHolstNielsen: JSON.parse doesn't
accept strings contain new lines
http://code.google.com/p/v8/issues/detail?id=616
It seems to be an "issue" with the Chrome json_reader, in the sense that it
is more
accepting than required by the JSON standard (if I read it correctly).
However, it is a different JSON parser from the one used by V8 - the V8 one
is
integrated in our JavaScript parser and generates a syntax tree that we can
compile,
whereas the Chrome json-reader is stand-alone and parses directly to C++
values.
The reason that the V8 JSON parser is so strict is that the ECMAScript 5
standard
requires it. There is no such requirement of the JSON reader used
internally in
Chrome. Or, to quote ECMAScript 262 Ed. 5, section 15.12:
"Conforming implementations of JSON.parse and JSON.stringify must support
the exact
interchange format described in this specification without any deletions or
extensions to the format. This differs from RFC 4627 which permits a JSON
parser to
accept non-JSON forms and extensions."
I.e., Chrome isn't doing anything inherently wrong in accepting embedded
newlines,
but it does mean that "Chrome accepts it" can't be used as an argument that
the input
is valid JSON.
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev