It was happening because of the sigil , I found it finally and solved it by replacing the body of the inner json into a String that would contain a place holder for it.
So my requirement here was the value of a key in the map would be another json , that json would also be derived from a map , I used Jason.encode to do this , it puts an escape \" before the starting braces ,
and then after composing the body of the final json I used sigil (~s) which had put another escape prefixing the escape , which was causing a problem during Jason.decode since it was unable to find the start of the inner map.
How I fixed it is in the final json I just put a placeholder <body> and then replaced the body with the Jason.encode inner json string.
With sigils is there a way to avoid escaping the escape characters to construct the right json that can be used flawlessly with Jason.decode
These variants should both work. I’m not sure about exact quoting here, so it might be, that you need to wrap the interpolated value in another pair of quotes.
True but as is , the string causes a problem when I try to decode it using Jason.decode
Its unable to find the inner map… , any way we can counter that problem and have my desired structure back from the json string , if you need the original Elixir map which I converted to Json and and want to have it back , let me know.