title: C# - Cannot deserialize JSON into List<T>
body: <p>I'm fetching a list of entries in a BD with a GET request (I'm using RestSharp to make the request) and I want to deserialize the content of the response into a List.</p>
  
  <p>The type of list elements is "Mileage":</p>
  
  <pre><code>public class Mileage
  {
      public int BranchId { get; set; }
      public int RouteId { get; set; }
      public int Travels { get; set; }
      public int Monday { get; set; }
      public int Tuesday { get; set; }
      public int Wednesday { get; set; }
      public int Thursday { get; set; }
      public int Friday { get; set; }
      public int Saturday { get; set; }
      public int Sunday { get; set; }
  }
  </code></pre>
  
  <p>And the response.Content is like this:</p>
  
  <pre><code>{
  "TheoreticalMileages": [
      {
        "BranchId": 36,
        "RouteId": 1860,
        "Travels": 10,
        "Monday": 132,
        "Tuesday": 89,
        "Wednesday": 92,
        "Thursday": 104,
        "Friday": 112,
        "Saturday": 0,
        "Sunday": 79
      },
      {
        "BranchId": 7,
        "RouteId": 2600,
        "Travels": 12,
        "Monday": 40,
        "Tuesday": 30,
        "Wednesday": 40,
        "Thursday": 100,
        "Friday": 121,
        "Saturday": 130,
        "Sunday": 0
      },
      {
        "BranchId": 23,
        "RouteId": 33,
        "Travels": 8,
        "Monday": 54,
        "Tuesday": 50,
        "Wednesday": 35,
        "Thursday": 50,
        "Friday": 67,
        "Saturday": 32,
        "Sunday": 30
      }
    ],
    "TotalRecords": 3
  }
  </code></pre>
  
  <p>I'm using Newtonsoft JSON.NET to deserialize the object into a list of mileages. I've already tried to convert it to a List and an IEnumerable:</p>
  
  <pre><code>var mileages = JsonConvert.DeserializeObject&lt;IEnumerable&lt;Mileage&gt;&gt;(getAllResponse.Content);
  </code></pre>
  
  <p>But I get the same error with both types of collections: "Cannot deserialize the current json object because the type requires a json array[...]"</p>
  
  <p>Is there a way to convert the object directly into a list? Thanks in advance.</p>