title: ASP.NET web API casting http response to json array
body: <p><br/><br/>
  My Code works fine when calling REST URL:<br/>
  <a href="http://api.feedzilla.com/v1/categories.json" rel="noreferrer">http://api.feedzilla.com/v1/categories.json</a></p>
  
  <p>but when I call following URL I get error:<br/>
  <a href="http://api.feedzilla.com/v1/categories/15/articles.json?count=36&amp;since=2012-11-15&amp;client_source=&amp;order=relevance&amp;title_only=0&amp;" rel="noreferrer">http://api.feedzilla.com/v1/categories/15/articles.json?count=36&amp;since=2012-11-15&amp;client_source=&amp;order=relevance&amp;title_only=0&amp;</a></p>
  
  <p>Error:</p>
  
  <pre><code>{"Cannot deserialize the current JSON object (e.g. {\"name\":\"value\"}) into type 'System.Collections.Generic.IEnumerable`1[Nitin.News.DAL.Resources.Article]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.\r\nTo fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List&lt;T&gt;) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.\r\nPath 'articles', line 1, position 12."}
  </code></pre>
  
  <p>My Code is as follows:</p>
  
  <pre><code>    public class Article
      {
          public string publish_date { get; set; }
          public string source { get; set; }
          public string source_url { get; set; }
          public string summary { get; set; }
          public string title { get; set; }
          public string url { get; set; }
      }
      public IEnumerable&lt;Article&gt; Get()
      {
          HttpClient client = new HttpClient();
          client.BaseAddress = new Uri("http://api.feedzilla.com/v1/");
  
          //Add an Accept header for JSON format.
          client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
  
          // call the REST method
          HttpResponseMessage response = client.GetAsync("http://api.feedzilla.com/v1/categories/2/articles.json??count=36&amp;since=2012-11-15&amp;client_source=&amp;order=relevance&amp;title_only=0&amp;").Result;  // Blocking call!
          if (response.IsSuccessStatusCode)
          {
              // Parse the response body. Blocking!
              return response.Content.ReadAsAsync&lt;IEnumerable&lt;Article&gt;&gt;().Result;
  
              //wont work
              //string JSON =response.Content.ReadAsStringAsync().Result;
              //return JsonConvert.DeserializeObject&lt;IEnumerable&lt;T&gt;&gt;(JSON);
          }
          else
          {
              throw new Exception(string.Format("Data access faild,{0} ({1}) method:{2}", (int)response.StatusCode, response.ReasonPhrase, MethodURL));
          }
      }
  </code></pre>