I’m trying to decode a string containing an escaped double quote, e.g. “I said, “Hello””
Now to do that in Elm, I may use Json.Decode as Decode:
Decode.decodeString Decode.string "\"I said, \"Hello\"\""
However, this is causing the decoder to fail. Can anyone explain why? I’d like to know how to have double quotes in my JSON string.
brian
2
When you escape the quotes like that you’re ending up with:
"I said, "Hello""
And that’s not valid JSON, so you will need to escape the quotes and the backslashes:
"\"I said, \\\"Hello\\\""
3 Likes
Thank you so much, I got what I was doing wrong!
1 Like
system
Closed
4
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.