title: Convert the http response body to JSON format using Unirest C#
body: <p>I am using mashape api: <a href="https://market.mashape.com/montanaflynn/dictionary" rel="nofollow noreferrer">https://market.mashape.com/montanaflynn/dictionary</a></p>
  
  <p>Here's my code:</p>
  
  <pre><code>HttpResponse&lt;RootObject&gt; response = Unirest.get("https://montanaflynn-dictionary.p.mashape.com/define?word=irony")
      .header("X-Mashape-Key", "my mashape key")
      .header("Accept", "application/json")
      .asJson&lt;RootObject&gt;();
  </code></pre>
  
  <p>I generated the RootObject class using: <a href="http://json2csharp.com/" rel="nofollow noreferrer">http://json2csharp.com/</a></p>
  
  <p>Here's my RootObject class code:</p>
  
  <pre><code>class Definition
  {
      public string text { get; set; }
      public string attribution { get; set; }
  }
  
  class RootObject
  {
      public List&lt;Definition&gt; definitions { get; set; }
  }
  </code></pre>
  
  <p>When I run the above code I get the following error:</p>
  
  <p><strong>An unhandled exception of type 'System.InvalidCastException' occurred in unirest-net.dll
  Additional information: Unable to cast object of type 'System.IO.MemoryStream' to type 'RootObject'.</strong></p>
  
  <p><strong>Question:</strong> How can I resolve the error?</p>