We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In JSON, double quotation mark in a JSON string is escaped as \", such as
\"
["\"foo\""]
should be escaped as "foo". But this library did not handle it and parsed it as \"foo\".
"foo"
\"foo\"
I reproduced the bug with the following test case:
SECTION("escape_dobulequote") { auto s = "[\"\\\"foo\\\"\"]"; json j = json::parse(s); CHECK(j == json({"\"foo\""})); }
Results:
test/unit.cpp:6351: FAILED: CHECK( j == json({"\"foo\""}) ) with expansion: ["\\\"foo\\\""] == "\"foo\""
The text was updated successfully, but these errors were encountered:
👍 I noticed this too. I've been manually escaping my strings
Sorry, something went wrong.
The problem is the escape_string function that seems to escape strings to strictly. I would be glad about help how to improve the function.
escape_string
@miloyip @jgod , could you try https://gist.github.com/nlohmann/84625311b4801cee5420 ?
fc58a73
nlohmann
No branches or pull requests
In JSON, double quotation mark in a JSON string is escaped as
\"
, such asshould be escaped as
"foo"
. But this library did not handle it and parsed it as\"foo\"
.I reproduced the bug with the following test case:
Results:
The text was updated successfully, but these errors were encountered: