can't deserialize string ending with backslash
vilinski opened this issue · 3 comments
Repro - add this to tests/Utf8Json.Tests/StringEscapeTest.cs
str = "\"\\\"";
JsonSerializer.Deserialize<string>(str).Is("\\");
the string, containing a single backslash can't be deserialized. The same bug is also reproducebla for other strings with a backslash at end.
Utf8Json/src/Utf8Json/JsonReader.cs
Lines 754 to 791 in 608cf01
Maybe this code is causing this bug.
This code works on policy like "Find first double quote,but if it is leaded by backslash,it is not a end of string.Otherwise,it is a end of string"
This policy doesn't work well in case of this.
#220
I made this pull request.
Actually,your issue was not correct.
You need "\"\\\\\""
for representing single backslash on Json.
But it was useful to find another issue.Thanks!
Cool, hope it will be merged