Currently, an SyntaxError is thrown, but the line and column properties are set to the call site of JSON.parse(). What I really want to know is the string that failed to parse, and where within string parsing failed (approximately). If the parse error says 'invalid number', I would expect to be able to figure out where it died. This is kind of difficult since the argument to JSON.parse is generally not a resource we already have in a text editor, so we'd need to figure out how to display that text (which could be megabytes of JSON).
Ping for import.
<rdar://problem/26516676>
This is pretty bad: jsc -e 'JSON.parse("{\"a\": {},}")' Exception: SyntaxError: JSON Parse error: Property name must be a string literal at [Command Line]:1 parse@[native code] global code@[Command Line]:1:11 Looks like it comes from JSC: Source/JavaScriptCore/runtime/LiteralParser.cpp: m_parseErrorMessage = ASCIILiteral("Property name must be a string literal"); There are some tests for it: LayoutTests/js/dom/JSON-parse-expected.txt:PASS tests[i](nativeJSON) threw exception SyntaxError: JSON Parse error: Property name must be a string literal. LayoutTests/js/dom/JSON-parse-expected.txt:PASS tests[i](nativeJSON) threw exception SyntaxError: JSON Parse error: Property name must be a string literal. I may un-lazy and try to improve it at some point...