Skip to content

Parsing string values as JSON-strings bug? #4397

Answered by gregmarr
allanbbs asked this question in Q&A
Discussion options

You must be logged in to vote

When converting that JSON string to a C++ string, you need to escape both " and \, or use a raw string literal.

json.parse(R"({
"dummy" : "\"xd\""
})");

https://www.godbolt.org/z/q6b3nv4Md

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@allanbbs
Comment options

@gregmarr
Comment options

Answer selected by allanbbs
@allanbbs
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants