DynDeveloper.com

DynDeveloper.com

Sign Up Now!Log In
carls 5/24/2018 10:32:02 AM

Deserializing JSON with embedded classes and arrays.

* This article, and all our great .NET Development documentation, Is available on the .NET Development menu

Need to parse a JSON object that contains embedded classes and arrays for Dynamics GP.

 

Sample JSON:

{
  "totalItemCount": 7,
  "pageIndex": 0,
  "pageSize": 20,
  "pagedData": [
    {
      "orderId": "6f98e70f-85ba-45ad-8474-e9b5cd409a39",
      "invoiceNumber": "2018050309232244AFM27JTLLAQ",
      "orderDate": "2018-05-03T04:23:22.0000000",
      "subTotal": "0.10",
      "taxTotal": "0",
      "shippingTotal": "0",
      "processingFeeTotal": "0.00",
      "orderTotal": "0",
      "orderDetail": [
        {
          "orderDetailId": "1bd708ee-1abe-4b19-9541-ced7988ff177",
          "orderId": "6f98e70f-85ba-45ad-8474-e9b5cd409a39",
          "productId": "dd5d6ce1-3663-42aa-a650-36ba40699000",
          "quantity": 1,
          "productPrice": "0.10",
          "sku": "SKU_001002",
          "productName": "(test only) beautiful flowers"
        }
      ],
      "accountingOrderTypeId": "c0aaefe9-4144-48ea-8a66-a539352d381e",
      "accountingOrderTypeName": "Mobile",
      "posCatalogName": "",
      "subTotalBeforeDiscounts": "0.10",
      "shippingTotalBeforeDiscounts": "0"
    },
    {
      "orderId": "3fa33505-fefd-4c1e-83bc-70d950c8272c",
      "invoiceNumber": "20180504074446767TYVXRC0CVSO",
      "orderDate": "2018-05-04T02:44:46.0000000",
      "subTotal": "0.10",
      "taxTotal": "0",
      "shippingTotal": "0",
      "processingFeeTotal": "0.00",
      "orderTotal": "0",
      "orderDetail": [
        {
          "orderDetailId": "dc81986c-5d7c-4e31-96c6-b889ba58cca4",
          "orderId": "3fa33505-fefd-4c1e-83bc-70d950c8272c",
          "productId": "dd5d6ce1-3663-42aa-a650-36ba40699000",
          "quantity": 1,
          "productPrice": "0.10",
          "sku": "SKU_001002",
          "productName": "(test only) beautiful flowers"
        }
      ],
      "accountingOrderTypeId": "c0aaefe9-4144-48ea-8a66-a539352d381e",
      "accountingOrderTypeName": "Mobile",
      "posCatalogName": "",
      "subTotalBeforeDiscounts": "0.10",
      "shippingTotalBeforeDiscounts": "0"
    },
    {
      "orderId": "4c27c368-4af8-4107-9c9a-fb6f3e0964b7",
      "invoiceNumber": "20180504080648354UM374RJFWJX",
      "orderDate": "2018-05-04T03:06:48.0000000",
      "subTotal": "0.10",
      "taxTotal": "0",
      "shippingTotal": "0",
      "processingFeeTotal": "0.00",
      "orderTotal": "0",
      "orderDetail": [
        {
          "orderDetailId": "f06cac63-526b-41e3-b2a5-9a50d62b8f3c",
          "orderId": "4c27c368-4af8-4107-9c9a-fb6f3e0964b7",
          "productId": "dd5d6ce1-3663-42aa-a650-36ba40699000",
          "quantity": 1,
          "productPrice": "0.10",
          "sku": "SKU_001002",
          "productName": "(test only) beautiful flowers"
        }
      ],
      "accountingOrderTypeId": "c0aaefe9-4144-48ea-8a66-a539352d381e",
      "accountingOrderTypeName": "Mobile",
      "posCatalogName": "",
      "subTotalBeforeDiscounts": "0.10",
      "shippingTotalBeforeDiscounts": "0"
    },
    {
      "orderId": "ea430036-08cf-4203-880b-264123ea323e",
      "invoiceNumber": "20180504113951344IK6VHPJX9IP",
      "orderDate": "2018-05-04T06:39:51.0000000",
      "subTotal": "0.10",
      "taxTotal": "0",
      "shippingTotal": "0",
      "processingFeeTotal": "0.00",
      "orderTotal": "0",
      "orderDetail": [
        {
          "orderDetailId": "7a0c556d-5262-499f-aa19-4210714348f8",
          "orderId": "ea430036-08cf-4203-880b-264123ea323e",
          "productId": "dd5d6ce1-3663-42aa-a650-36ba40699000",
          "quantity": 1,
          "productPrice": "0.10",
          "sku": "SKU_001002",
          "productName": "(test only) beautiful flowers"
        }
      ],
      "accountingOrderTypeId": "c0aaefe9-4144-48ea-8a66-a539352d381e",
      "accountingOrderTypeName": "Mobile",
      "posCatalogName": "",
      "subTotalBeforeDiscounts": "0.10",
      "shippingTotalBeforeDiscounts": "0"
    },
    {
      "orderId": "77c4822d-ff6a-4c49-bdcb-0f75aa29d258",
      "invoiceNumber": "20180504114302195NQ13D1BPDR7",
      "orderDate": "2018-05-04T06:43:02.0000000",
      "subTotal": "0.10",
      "taxTotal": "0",
      "shippingTotal": "0",
      "processingFeeTotal": "0.00",
      "orderTotal": "0",
      "orderDetail": [
        {
          "orderDetailId": "3854f0da-0e89-48b9-a83b-5f8a40e2a50d",
          "orderId": "77c4822d-ff6a-4c49-bdcb-0f75aa29d258",
          "productId": "dd5d6ce1-3663-42aa-a650-36ba40699000",
          "quantity": 1,
          "productPrice": "0.10",
          "sku": "SKU_001002",
          "productName": "(test only) beautiful flowers"
        }
      ],
      "accountingOrderTypeId": "c0aaefe9-4144-48ea-8a66-a539352d381e",
      "accountingOrderTypeName": "Mobile",
      "posCatalogName": "",
      "subTotalBeforeDiscounts": "0.10",
      "shippingTotalBeforeDiscounts": "0"
    },
    {
      "orderId": "f08dd1a1-69d1-4fe6-a19d-096e0cc462df",
      "invoiceNumber": "20180504125640107DUGQ60L72GC",
      "orderDate": "2018-05-04T07:56:40.0000000",
      "subTotal": "6.75",
      "taxTotal": "0",
      "shippingTotal": "0",
      "processingFeeTotal": "0.34",
      "orderTotal": "0",
      "orderDetail": [
        {
          "orderDetailId": "bbec5ccc-e214-4e3e-a5df-a2c7fbdb5af2",
          "orderId": "f08dd1a1-69d1-4fe6-a19d-096e0cc462df",
          "productId": "87b40cc5-5f41-46de-8336-27ccde97c8f6",
          "quantity": 1,
          "productPrice": "6.75",
          "sku": "LTDQA-004-GMBNDL",
          "productName": "10th anniversary celebration"
        }
      ],
      "accountingOrderTypeId": "c0aaefe9-4144-48ea-8a66-a539352d381e",
      "accountingOrderTypeName": "Mobile",
      "posCatalogName": "",
      "subTotalBeforeDiscounts": "6.75",
      "shippingTotalBeforeDiscounts": "0"
    },
    {
      "orderId": "09e66c4e-61c5-48dc-964c-26f5a2f4b7bd",
      "invoiceNumber": "20180504083011249KAXGIETOQ0K",
      "orderDate": "2018-05-04T08:30:02.0000000",
      "subTotal": "59.95",
      "taxTotal": "0",
      "shippingTotal": "0",
      "processingFeeTotal": "0",
      "orderTotal": "0",
      "orderDetail": [
        {
          "orderDetailId": "125b33c4-2084-4026-b54d-fcb9ee6d6183",
          "orderId": "09e66c4e-61c5-48dc-964c-26f5a2f4b7bd",
          "productId": "c4546911-ac06-45c1-ad4c-8780c24630a3",
          "quantity": 1,
          "productPrice": "59.95",
          "sku": "S16-1963-NMB",
          "productName": "New Member Basic"
        }
      ],
      "accountingOrderTypeId": "ae8d6853-fb1f-42d9-9b96-f8bb744336fe",
      "accountingOrderTypeName": "Automatic Subscription Renewal",
      "posCatalogName": "",
      "subTotalBeforeDiscounts": "59.95",
      "shippingTotalBeforeDiscounts": "0"
    }
  ]
}

 

 

 

Version: All
Section: Dynamics GP,.NET Development