Json: Parser issues

Created on 16 Mar 2017  路  6Comments  路  Source: nlohmann/json

on a following json {"body": "text\v"}
it gives
parse error at 10: parse error - unexpected '"'

dropbox/json11 gives:

unescaped (11) in string

which is correct (this is an unescaped vertical tab, disallowed by JSON std)

confirmed bug

All 6 comments

The scanner recognizes the malformed string and returns a parse_error token. The problem is the implementation of the unexpect function. I wanted to be clever and avoid a unexpected parse error output, so I output the text of the last token which in this case is only the opening ". I have to look into this.

With the overworked scanner in branch manual_lexer, the error message for the above code is

[json.exception.parse_error.101] parse error at 16: syntax error - invalid string: forbidden character after backspace; last read '"text\v'

The example in #551 shows that the diagnosis information got better. However, the output could be improved: last read '"\303?' does not help too much here.

The new scanner (merged yesterday) now provides the diagnosis information described in https://github.com/nlohmann/json/issues/509#issuecomment-289915749.

After backspace?

Ooops. Fixed this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

qis picture qis  路  4Comments

koemeet picture koemeet  路  4Comments

jmlemetayer picture jmlemetayer  路  3Comments

alienzj picture alienzj  路  4Comments

asmaloney picture asmaloney  路  4Comments