Question Background:
I am receiving a JSON string response from a HttpResponseMessage
object via the Task
ReadAsStringAsync
method, as shown:
string jsonString = response.Content.ReadAsStringAsync().Result;
This gives me the following escaped JSON:
"\"{\\\"A\\\":\\\"B\\\"}\""
The Question:
I believe that this is being escaped twice which mean I am trying to map this JSON to a C# POCO I am having via Newtonsoft to convert it to a string type, then to my desired object type, as shown:
var model = JsonConvert.DeserializeObject<T>(JsonConvert.DeserializeObject<string>(response.Content.ReadAsStringAsync().Result));
Is there a way to stop this double escaping so I do not have to deserialize the JSON twice?