title: Deserialize multiple json into object c#
body: <p>I'm trying to deserialize a json string from a API call with multiple objects but without much success.</p>
  
  <p>JSON:</p>
  
  <pre><code>@{
      "purchaseOrders": [
          {
              "supplierId": "500",
              "currencyCode": "EUR",
              "companyId": "LALA",
              "companyName": "LALA",
              "purchaseOrderLines": [
                  {
                      "lineNumber": "10",
                      "itemNumber": "255",
                      "itemDescription": "TestItem2",
                      "unitPrice": 24.64,
                      "quantity": 2,
                      "isServiceBased": false,
                      "taxIndicator1": "LAAA5",
                      "taxIndicator2": "4",
                      "unit": "-",
                      "deliveryLines": [],
                      "supplierItems": [],
                      "isActive": true
                  },
                  {
                      "lineNumber": "20",
                      "itemNumber": "5555555",
                      "itemDescription": "3test, Ind",
                      "unitPrice": 32.56,
                      "quantity": 2,
                      "isServiceBased": false,
                      "taxIndicator1": "LAAA5",
                      "taxIndicator2": "4",
                      "unit": "-",
                      "deliveryLines": [],
                      "supplierItems": [],
                      "isActive": true
                  }
              ],
              "orderIdentifier": "261656",
              "supplierName": "Lopes BVBA",
              "orderType": "T",
              "isActive": true
          },
          {
              "supplierId": "5555",
              "currencyCode": "EUR",
              "companyId": "API",
              "companyName": "LALA2",
              "purchaseOrderLines": [
                  {
                      "lineNumber": "1",
                      "itemNumber": "448",
                      "itemDescription": "TestItem",
                      "unitPrice": 1563.23117,
                      "quantity": 1,
                      "isServiceBased": false,
                      "unit": "-",
                      "deliveryLines": [],
                      "supplierItems": [],
                      "isActive": true
                  },
                  {
                      "lineNumber": "2",
                      "itemNumber": "5551",
                      "itemDescription": "Test",
                      "unitPrice": 524.92539,
                      "quantity": 1,
                      "isServiceBased": false,
                      "unit": "-",
                      "deliveryLines": [],
                      "supplierItems": [],
                      "isActive": true
                  }
              ],
              "orderIdentifier": "84615",
              "supplierName": "CLopes.",
              "orderType": "T",
              "isActive": true
          }]
  </code></pre>
  
  <p>I created the following model classes:</p>
  
  <pre><code>public class purchaseOrder
  {
          public string supplierId { get; set; }
          public string currencyCode { get; set; }
          public string companyId { get; set; }
          public string companyName { get; set; }
          public List&lt;purchaseOrderLines&gt; purchaseOrderLines { get; set; }
          public double orderIdentifier { get; set; }
          public string supplierName { get; set; }
          public string Ordertype { get; set; }
          public bool isActive { get; set; }
  }
  
  public class purchaseOrderLines
  {
          public int lineNumber { get; set; }
          public string itemnumber { get; set; }
          public string itemDescription { get; set; }
          public double unitPrice { get; set; }
          public int quantity { get; set; }
          public bool isServiceBased { get; set; }
          public string unit { get; set; }  
          public List&lt;deliveryLines&gt; deliveryLines { get; set; }
          public string[] supplierItems { get; set; }
          public bool isActive { get; set; }
  }
  
  public class deliveryLines
  {
          public int deliveredQuantity { get; set; }
          public DateTime? deliveredDate { get; set; }
          public string   deliveryNote { get; set; }
          public bool isActive { get; set; }
  }
  </code></pre>
  
  <p>I tried doing this by deserializing the string into a purchaseOrder </p>
  
  <pre><code>(purchaseOrder purchaseOrderobject  = JsonConvert.DeserializeObject&lt;purchaseOrder &gt;(json);)
  </code></pre>
  
  <p>but with no success. I think maybe I have to make use of a dictionary for this but I'm not completely sure how to do that.</p>
  
  <p>Is there a way to do this by getting the json objects one by one an deserializing them like in the following link?</p>
  
  <p><a href="https://www.newtonsoft.com/json/help/html/QueryingLINQtoJSON.htm#Index" rel="nofollow noreferrer">Deserialize single object</a></p>