zaach / jsonlint

A JSON parser and validator with a CLI.
http://zaach.github.com/jsonlint/
1.94k stars 420 forks source link

Incorrect error message and error location for invalid escape sequences #142

Open serpent7776 opened 2 years ago

serpent7776 commented 2 years ago

Incorrect error message and error location for invalid escape sequences:

{
    "": "foobar\?"
}

Current message:

Error: Parse error on line 2:
{   "": "foobar\?"}
------^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'

Expected error message:

Invalid escape sequence \?

Error location should point directly at \?. Current location is especially confusing for very long strings.