title: Storing JSON REST response in object
body: <p>I am new to <code>C#</code> and I am trying to work out how to store my <code>HTTPResponseMessage</code> in an object.</p>
  
  <pre><code>static async Task RunAsync()
      {
          using (var client = new HttpClient())
          {
              client.BaseAddress = new Uri("http://api.themoviedb.org/3/");
              client.DefaultRequestHeaders.Accept.Clear();
              client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
  
              HttpResponseMessage response = await client.GetAsync("search/tv?api_key=MY_KEYa&amp;query=hawaii%20five%20o&amp;first_air_date_year=2010");                
  
              if (response.IsSuccessStatusCode)
              {
  
  
                  // What to do here..?
  
  
              }
          }
      }
  </code></pre>
  
  <p>I used this site (<a href="http://www.asp.net/web-api/overview/advanced/calling-a-web-api-from-a-net-client" rel="nofollow">http://www.asp.net/web-api/overview/advanced/calling-a-web-api-from-a-net-client</a>) for the above code.</p>
  
  <p>Using this website (<a href="http://json2csharp.com/" rel="nofollow">http://json2csharp.com/</a>), I created the following class:</p>
  
  <pre><code>class TVShowDTO
  {
      public string backdrop_path { get; set; }
      public int id { get; set; }
      public string original_name { get; set; }
      public string first_air_date { get; set; }
      public List&lt;string&gt; origin_country { get; set; }
      public string poster_path { get; set; }
      public double popularity { get; set; }
      public string name { get; set; }
      public int vote_average { get; set; }
      public int vote_count { get; set; }
  }
  </code></pre>
  
  <p>API Response:</p>
  
  <pre><code>{
     page: 1
     results: [1]
     0:  {
     backdrop_path: "/mAXpHFDTMHvJt7WdibFWdbRsdCG.jpg"
     id: 32798
     original_name: "Hawaii Five-0"
     first_air_date: "2010-09-20"
     origin_country: [1]
     0:  "US"
     -
     poster_path: "/hO4BgEJhGIrFJ7f00sR6ZcdNB6y.jpg"
     popularity: 1.06099324148627
     name: "Hawaii Five-0"
     vote_average: 7.3
     vote_count: 6
     }-
     -
     total_pages: 1
     total_results: 1
  }
  </code></pre>
  
  <p>Here is a link to the <code>API</code> I am trying to access: <a href="http://docs.themoviedb.apiary.io/reference/search/searchtv/get" rel="nofollow">http://docs.themoviedb.apiary.io/reference/search/searchtv/get</a></p>
  
  <p>Do I need to get the <code>response</code> as a <code>string</code> first? Because the examples I have seen of this on SO, seem to use an input <code>string</code>. </p>
  
  <p>I haven't been able to work this out as when I print <code>response.Content</code>, it just returns <code>"System.Net.Http.StreamContent"</code></p>
  
  <p>Any guidance with this would be greatly appreciated.</p>