"{\"topic\": \"dummy_topic\", \"msg\": \"{\"fruit\":\"apple\",\"dish\":\"apple-pie\"}\"}" → This does not work
iex(1)> Jason.decode("{\"topic\": \"dummy_topic\", \"msg\": \"{\"fruit\":\"apple\",\"dish\":\"apple-pie\"}\"}")
{:error,
%Jason.DecodeError{
data: "{\"topic\": \"dummy_topic\", \"msg\": \"{\"fruit\":\"apple\",\"dish\":\"apple-pie\"}\"}",
position: 35,
token: nil
}}
"{\"topic\": \"dummy_topic\", \"msg\": {\"fruit\":\"apple\",\"dish\":\"apple-pie\"}}" → This works
iex(2)> Jason.decode("{\"topic\": \"dummy_topic\", \"msg\": {\"fruit\":\"apple\",\"dish\":\"apple-pie\"}}")
{:ok,
%{
"msg" => %{"dish" => "apple-pie", "fruit" => "apple"},
"topic" => "dummy_topic"
}}
The only difference between the strings is
"{\"topic\": \"dummy_topic\", \"msg\": *\"*{\"fruit\":\"apple\",\"dish\":\"apple-pie\"}*\"*}"
The escape sequences causing problem are wrapped in *
Those two escape sequences if removed , makes it work fine.
Is there a way with Sigils I can choose to not have those escapes ? or I have to do string manipulation to have it working ?






















