question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JsonReader fails to read string with escaped Backslashes

See original GitHub issue

As I updated the project today I wondered about a json-parsing error. Using 1.3.2-Snapshot (23.08.2014).

    String fails0 = "{text: meow\\meow}";
    String fails1 = "{text: \"meow \\ \" }";
    String fails2 = "{text: \"meow \\ \" }";
    String works = "{text: \"meow \\\"meow\\\"\" }";
    JsonReader jsonReader = new JsonReader();
    JsonValue jsonValue = jsonReader.parse(test);

fail0 worked in 1.2.0, (maybe in some 1.3.2 version but I am not sure) fails1 throws: Illegal escaped character: \ fails2 throws: Error parsing JSON, unmatched brace. Cheers

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dermetfancommented, Sep 23, 2014

these String literals except works01 don’t compile (they do after your edit)

0reactions
Phibedycommented, Sep 23, 2014

thanks made it clear 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

When parse the string to JsonElement, how to avoid auto read ...
I want to use gson to parse this str to jsonElement. eg. ... It seems like when JsonReader meet the '\', it will...
Read more >
Backslash not properly escaped in server-generated JSON
An error occurs when calling the javascript JSON.parse() function, and for this reason, the entire file list is not displayed in the Devices ......
Read more >
Solved: Invalid JSON. An unrecognized escape sequence '\T'...
JSON use it to escape special characters in strings and in order to represent a backslash correctly in strings you have to prepend...
Read more >
Parse JSON string that contains file path : r/csharp - Reddit
Looks like JSON wants the backslashes escaped, and trying to do this without a @ verbatim string is a nightmare. It's generally a...
Read more >
SyntaxError: JSON.parse: bad parsing - JavaScript | MDN
The JavaScript exceptions thrown by JSON.parse() occur when string failed to be parsed as JSON.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found