Skip to content

JSON.parse("") gives very ambigious "Syntax Error". #804

@nojvek

Description

@nojvek
JSON.parse("")
$ ch.exe jsonParseEmpty.js
SyntaxError: Syntax error
   at Global code (d:\personal\chakracore\build\vcbuild\bin\x64_debug\test.js:1:1)

'Syntax Error' is very ambiguous error. It could mean a lot of things. When its part of a large callstack, I would think its a javascript syntax error somewhere in my js files. The callstack doesn't even mention JSON.parse.

Chrome gives

VM145:1 Uncaught SyntaxError: Unexpected end of JSON input(…) 

Ideal error should mention something like "JSON.parse Syntax error: Empty string" or "JSON.parse Syntax Error: unexpected end of json input."

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions