Skip to content
This repository has been archived by the owner on May 16, 2022. It is now read-only.

Deserializing string with escaped backslash fails #121

Open
brotherBear opened this issue Oct 25, 2018 · 1 comment
Open

Deserializing string with escaped backslash fails #121

brotherBear opened this issue Oct 25, 2018 · 1 comment

Comments

@brotherBear
Copy link

{
    "attr_x": "C:\\some gx\\",
    "attr_v": 30
}

It doesn't matter what the target C# object is. The error is related to the gx\\" part, and the deserializer apparently can't identify the double-quote because of the escaped back-slash.

This yields the following error response:

System.AggregateException : One or more errors occurred.
  ----> Utf8Json.JsonParsingException : expected:',', actual:'a', at offset:40
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
.....
--JsonParsingException
   at Utf8Json.JsonReader.ReadIsValueSeparatorWithVerify()
   at Utf8Json.JsonReader.ReadIsEndObjectWithSkipValueSeparator(Int32& count)

If I modify the input JSON to:

{
    "attr_x": "C:\\some gx\\"
}

the resulting error is:

System.AggregateException : One or more errors occurred.
  ----> Utf8Json.JsonParsingException : not found end string.
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
.....
--JsonParsingException
   at Utf8Json.JsonReader.ReadNextCore(JsonToken token)
   at Utf8Json.JsonReader.ReadNextBlockCore(Int32 stack)

In both cases, if I modify the gx\\" to gx" all the tests are green.

Originally posted by @brotherBear in https://github.com/neuecc/Utf8Json/issue_comments#issuecomment-432936975

@buybackoff
Copy link

See #63 and #96

AlexeyVoid pushed a commit to AlexeyVoid/Utf8Json that referenced this issue Mar 16, 2020
AlexeyVoid added a commit to AlexeyVoid/Utf8Json that referenced this issue Mar 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants