title: ASP.Net Core Api: how to deserialize a double-serialized JSON object
body: <p>I'm using a central API in ASP.Net Core to authenticate users and to create JSON Web Tokens. The central API, in turn, calls other APIs to get other data, such as user profile data and subscription information. However, the central API receives double-serialized JSON objects that I cannot seem to deserialize. Here's the code from the central API:</p>
  <pre><code>Request.Host = new HostString(_usersApi);
  
  HttpRequestMessageFeature hreqmf = new HttpRequestMessageFeature(HttpContext);
  HttpRequestMessage httpRequestMessage = hreqmf.HttpRequestMessage;
  
  var client = new HttpClient();
  var response = await client.SendAsync(httpRequestMessage, 
  HttpCompletionOption.ResponseHeadersRead);
  var data = response.Content.ReadAsStringAsync();
  
  var deserialized = JsonConvert.DeserializeObject&lt;MyObject&gt;(data.Result);
  
  return Ok(deserialized);
  </code></pre>
  <p><code>data.Result</code> equals <code>&quot;{\&quot;property1\&quot;:\&quot;value1\&quot;,\&quot;property2\&quot;:\&quot;value2\&quot;}&quot;</code></p>
  <p>I cannot deserialize it to</p>
  <pre class="lang-json prettyprint-override"><code>{&quot;Property1&quot;: &quot;value1&quot;, &quot;Property2&quot;: &quot;value2&quot;}
  </code></pre>
  <p>What am I missing? Thanks.</p>