title: Cannot deserialize the current JSON object
body: <p>Cannot De-Serialize the current <code>JSON</code> object (e.g. <code>{"name":"value"}</code>) into type <code>'System.Collections.Generic.List</code>1[NIPRA.Models.OrderHeaderResult]'<code>because the type requires a</code>JSON array (e.g. [1,2,3])` to De-Serialize correctly.</p>
  
  <p>To fix this error either change the <code>JSON</code> to a <code>JSON array (e.g. [1,2,3])</code> or change the De-Serialized type so that it is a normal .NET type (e.g. not a primitive type like <code>integer</code>, not a collection type like an array or List) that can be De-Serialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to De-Serialize from a JSON object.</p>
  
  <h2>Path 'Orders', line 1, position 10.</h2>
  
  <p>Json data:</p>
  
  <pre><code>{"Orders":
  [{"Id":397908,
  "BuyerId":1831,
  "DateCreated":"2016-02-16T10:58:55",
  "DateUpdated":"2016-02-16T10:58:55",
  "DeliveryDate":"2015-01-20T00:00:00",
  "UploadDate":"2016-02-16T10:58:55",
  "InvoiceToName":"Lancet Laboratories (Pty) Ltd",
  "OrderDate":"2016-02-16T08:58:55",
  "OrderNumber":"PTYPO000006",
  "OrderStatusId":1,
  "OrderTotal":42050.3500,
  "OrderTypeId":2,
  "PartnerId":"V0002066  ",
  "SupplierAccountName":"Bio-Rad Laboratories (Pty) Ltd",
  "SupplierId":1696,
  "ShipToName":"Rich Corn",
  "SystemOrderStatusId":1,
  "TermsOfPayment":"30DS",
  "Supplier":null,
  "Buyer":"Lancet Laboratories",
  "BuyerName":"juri.vdv",
  "BuyerAccountNumber":"",
  "OrderStatus":"Requested",
  "OrderType":"PURCHASE",
  "HasComments":"No",
  "TotalExcludingVAT":36886.2700,
  "VATAmount":5164.0800,"AmendedBy":"System",
  "FileName":""}],
  "TotalPages":2}
  </code></pre>
  
  <hr>
  
  <p>My viewmodel:</p>
  
  <pre><code>public partial class OrderHeaderView
  {
      [JsonProperty("id")]
      public int Id { get; set; }
      [JsonProperty("buyerId")]
      public int BuyerId { get; set; }
      [JsonProperty("dateCreated")]
      public System.DateTime DateCreated { get; set; }
      [JsonProperty("dateUpdated")]
      public System.DateTime DateUpdated { get; set; }
      [JsonProperty("deliveryDate")]
      public Nullable&lt;System.DateTime&gt; DeliveryDate { get; set; }
      [JsonProperty("uploadDate")]
      public Nullable&lt;System.DateTime&gt; UploadDate { get; set; }
      [JsonProperty("invoiceToName")]
      public string InvoiceToName { get; set; }
      [JsonProperty("orderDate")]
      public Nullable&lt;System.DateTime&gt; OrderDate { get; set; }
      [JsonProperty("orderNumber")]
      public string OrderNumber { get; set; }
      [JsonProperty("orderStatusId")]
      public int OrderStatusId { get; set; }
      [JsonProperty("orderTotal")]
      public decimal OrderTotal { get; set; }
      [JsonProperty("orderTypeId")]
      public int OrderTypeId { get; set; }
      [JsonProperty("partnerId")]
      public string PartnerId { get; set; }
      [JsonProperty("supplierAccountName")]
      public string SupplierAccountName { get; set; }
      [JsonProperty("supplierId")]
      public int SupplierId { get; set; }
      [JsonProperty("shipToName")]
      public string ShipToName { get; set; }
      [JsonProperty("systemOrderStatusId")]
      public Nullable&lt;int&gt; SystemOrderStatusId { get; set; }
      [JsonProperty("termsOfPayment")]
      public string TermsOfPayment { get; set; }
      [JsonProperty("supplier")]
      public string Supplier { get; set; }
      [JsonProperty("buyer")]
      public string Buyer { get; set; }
      [JsonProperty("buyerName")]
      public string BuyerName { get; set; }
      [JsonProperty("buyerAccountNumber")]
      public string BuyerAccountNumber { get; set; }
      [JsonProperty("orderStatu")]
      public string OrderStatus { get; set; }
      [JsonProperty("orderType")]
      public string OrderType { get; set; }
      [JsonProperty("hasComments")]
      public string HasComments { get; set; }
      [JsonProperty("totalExcludingVAT")]
      public decimal TotalExcludingVAT { get; set; }
      [JsonProperty("vatAmount")]
      public decimal VATAmount { get; set; }
      [JsonProperty("amendedBy")]
      public string AmendedBy { get; set; }
      [JsonProperty("fileName")]
      public string FileName { get; set; }
      [JsonProperty("hasDelivery")]
      public bool HasDelivery { get; set; }
  }
  </code></pre>
  
  <hr>
  
  <p>RootObject model:</p>
  
  <pre><code>public class OrderHeaderResult
  {
      public int TotalPages { get; set; }
      public OrderHeaderView[] Orders { get; set; }
  }
  </code></pre>
  
  <hr>
  
  <pre><code>public async Task&lt;List&lt;OrderHeaderResult&gt;&gt; GetOrders(int statusId, int page, string keyword, int year)
  
      {
          _client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", UserToken.AccessToken);
          var result = await _client.GetAsync($"api/invoicing/getorders?statusId={statusId}&amp;page={page}&amp;keyword={keyword}&amp;year={year}");
          if (result.IsSuccessStatusCode)
          {
              var orderData = await result.Content.ReadAsStringAsync();
  
              return JsonConvert.DeserializeObject&lt;List&lt;OrderHeaderResult&gt;&gt;(orderData);    
  
          }
          else
              return null;
      }
  </code></pre>
  
  <hr>
  
  <p>controller:</p>
  
  <pre><code>    [HttpGet]
      public async Task&lt;ActionResult&gt; Index(int? id, int?page, string keyword, int?year)
      {
          _orderService.UserToken = base.Token;
  
          var orders = await  _orderService.GetOrders(id??1,page??2,keyword,year??DateTime.Now.Year);
           return View(orders);
  
      }
  </code></pre>
  
  <p>please help and how to display this on razor view ?</p>