如何修复json错误,预期为“ STRING”,得到了“}”

时间:2019-06-09 19:31:38

标签: c# json

这是我认为是json输出的字符串。我正在

  

期待“ STRING”,得到“}”。

有人可以帮我解决这个问题吗?

{
    "shipToAddress": {
    "type": "ST",
    "recordId": "ST",
    "locationNumber": "",
    "companyName1": "",
    "companyName2": "",
    "address1": "",
    "address2": "",
    "address3": "",
    "address4": "",
    "city": "",
    "state": "",
    "postalCode": "",
    "country": "",
    "dunsNumber": "",
    "dunsType": "",
    "contactPhone": "",
    "contactEmail": "",
    "contactFax": "",
    "contactOther": "",
    "locationCode": "",
    "consolidator": ""
    },
    "shipFromAddress": {
    "type": "ST",
    "recordId": "ST",
    "locationNumber": "",
    "companyName1": "",
    "companyName2": "",
    "address1": "",
    "address2": "",
    "address3": "",
    "address4": "",
    "city": "",
    "state": "",
    "postalCode": "",
    "country": "",
    "dunsNumber": "",
    "dunsType": "",
    "contactPhone": "",
    "contactEmail": "",
    "contactFax": "",
    "contactOther": "",
    "locationCode": "",
    "consolidator": ""
    },
    "addresses": [
    {
      "type": "ST",
      "recordId": "ST",
      "locationNumber": "",
      "companyName1": "",
      "companyName2": "",
      "address1": "",
      "address2": "",
      "address3": "",
      "address4": "",
      "city": "",
      "state": "",
      "postalCode": "",
      "country": "",
      "dunsNumber": "",
      "dunsType": "",
      "contactPhone": "",
      "contactEmail": "",
      "contactFax": "",
      "contactOther": "",
      "locationCode": "",
      "consolidator": ""
    }
    ],
    "orders": [
    {
      "recordId": "3",
      "poNumber": "0006630041",
      "items": [
        {
          "itemComponents": [
            {
              "itemNotes": [
                {
                  "recordId": "",
                  "type": "",
                  "note": ""
                }
              ],
              "recordId": "3",
              "lineNo": "3",
              "sublineNo": "3",
              "originalLineNo": "3",
              "qty": 0,
              "unitMeasure": "EA",
              "upcCode": "",
              "vendorNumber": "",
              "unitSize": "42",
              "itemColor": "BLK/RED",
              "customerItem": "",
              "gtinNumber": "",
              "upcCaseCode": "",
              "prepackCode": "",
              "caseGroupCode": "",
              "skuNumber": "",
              "unitPrice": "405.46",
              "priceBasis": "",
              "sellingPrice": 995,
              "discountPercent": 0,
              "shipDate": 060419,
              "packSize": 1,
              "inners": 1,
              "itemDesc": "",
              "itemWeight": "",
              "itemReferenceId": 0,
              "lotNumber": "",
              "nrfSize": "",
              "nrfColor": "",
              "nrfDesc": "",
              "unitSizeBuyer": "",
              "itemColorBuyer": "",
              "buyerStyleNo": "",
              "countryOfOrigin": "",
              "ticketType": "",
              "mfgName": "",
              "mfgCity": "",
              "mfgCountry": ""
            }
          ],
          "recordId": "",
          "lineNo": "",
          "sublineNo": "",
          "originalLineNo": "",
          "qty": 0,
          "unitMeasure": "EA",
          "upcCode": "",
          "vendorNumber": "",
          "unitSize": "",
          "itemColor": "",
          "customerItem": "",
          "gtinNumber": "",
          "upcCaseCode": "",
          "prepackCode": "",
          "caseGroupCode": "",
          "skuNumber": "",
          "unitPrice": "",
          "priceBasis": "",
          "sellingPrice": 0,
          "discountPercent": 0,
          "shipDate": 0,
          "packSize": 0,
          "inners": 0,
          "itemDesc": "",
          "itemWeight": "",
          "itemReferenceId": 0,
          "lotNumber": "",
          "nrfSize": "",
          "nrfColor": "",
          "nrfDesc": "",
          "unitSizeBuyer": "",
          "itemColorBuyer": "",
          "buyerStyleNo": "",
          "countryOfOrigin": "",
          "ticketType": "",
          "mfgName": "",
          "mfgCity": "",
          "mfgCountry": "",
          "extItemRef": "",
          "custFld01Nam": "",
          "custFld01Val": "",
          "custFld02Nam": "",
          "custFld02Val": "",
          "custFld03Nam": "",
          "custFld03Val": "",
          "qtyShip": 0,
          "qtyRemain": 0,
          "itemPackCode": "",
          "itemDimensionLength": 0,
          "itemDimensionWidth": 0,
          "itemDimensionHeight": 0,
          "itemDimensionUom": "",
          "cartonLenght": 0,
          "cartonWidth": 0,
          "cartonHeight": 0,
          "cartonUom": "",
          "itemStatus": "AC",
          "statusReason": "backorder_cancel",
          "statusDesc": "",
          "qtyBackorder": 0,
          "backorderDate": 0
        },
        {
          "recordId": "4",
          "poNumber": "0006630041",
          "items": [
            {
              "itemComponents": [
                {
                  "itemNotes": [
                    {
                      "recordId": "",
                      "type": "",
                      "note": ""
                    }
                  ],
                  "recordId": "4",
                  "lineNo": "4",
                  "sublineNo": "4",
                  "originalLineNo": "4",
                  "qty": 0,
                  "unitMeasure": "EA",
                  "upcCode": "",
                  "vendorNumber": "",
                  "unitSize": "43",
                  "itemColor": "BLK/RED",
                  "customerItem": "",
                  "gtinNumber": "",
                  "upcCaseCode": "",
                  "prepackCode": "",
                  "caseGroupCode": "",
                  "skuNumber": "",
                  "unitPrice": "405.46",
                  "priceBasis": "",
                  "sellingPrice": 995,
                  "discountPercent": 0,
                  "shipDate": 060419,
                  "packSize": 1,
                  "inners": 1,
                  "itemDesc": "",
                  "itemWeight": "",
                  "itemReferenceId": 0,
                  "lotNumber": "",
                  "nrfSize": "",
                  "nrfColor": "",
                  "nrfDesc": "",
                  "unitSizeBuyer": "",
                  "itemColorBuyer": "",
                  "buyerStyleNo": "",
                  "countryOfOrigin": "",
                  "ticketType": "",
                  "mfgName": "",
                  "mfgCity": "",
                  "mfgCountry": ""
                }
              ],
              "recordId": "",
              "lineNo": "",
              "sublineNo": "",
              "originalLineNo": "",
              "qty": 0,
              "unitMeasure": "EA",
              "upcCode": "",
              "vendorNumber": "",
              "unitSize": "",
              "itemColor": "",
              "customerItem": "",
              "gtinNumber": "",
              "upcCaseCode": "",
              "prepackCode": "",
              "caseGroupCode": "",
              "skuNumber": "",
              "unitPrice": "",
              "priceBasis": "",
              "sellingPrice": 0,
              "discountPercent": 0,
              "shipDate": 0,
              "packSize": 0,
              "inners": 0,
              "itemDesc": "",
              "itemWeight": "",
              "itemReferenceId": 0,
              "lotNumber": "",
              "nrfSize": "",
              "nrfColor": "",
              "nrfDesc": "",
              "unitSizeBuyer": "",
              "itemColorBuyer": "",
              "buyerStyleNo": "",
              "countryOfOrigin": "",
              "ticketType": "",
              "mfgName": "",
              "mfgCity": "",
              "mfgCountry": "",
              "extItemRef": "",
              "custFld01Nam": "",
              "custFld01Val": "",
              "custFld02Nam": "",
              "custFld02Val": "",
              "custFld03Nam": "",
              "custFld03Val": "",
              "qtyShip": 0,
              "qtyRemain": 0,
              "itemPackCode": "",
              "itemDimensionLength": 0,
              "itemDimensionWidth": 0,
              "itemDimensionHeight": 0,
              "itemDimensionUom": "",
              "cartonLenght": 0,
              "cartonWidth": 0,
              "cartonHeight": 0,
              "cartonUom": "",
              "itemStatus": "AC",
              "statusReason": "backorder_cancel",
              "statusDesc": "",
              "qtyBackorder": 0,
              "backorderDate": 0
            },
            {
              "recordId": "5",
              "poNumber": "0006630041",
              "items": [
                {
                  "itemComponents": [
                    {
                      "itemNotes": [
                        {
                          "recordId": "",
                          "type": "",
                          "note": ""
                        }
                      ],
                      "recordId": "5",
                      "lineNo": "5",
                      "sublineNo": "5",
                      "originalLineNo": "5",
                      "qty": 0,
                      "unitMeasure": "EA",
                      "upcCode": "",
                      "vendorNumber": "",
                      "unitSize": "44",
                      "itemColor": "BLK/RED",
                      "customerItem": "",
                      "gtinNumber": "",
                      "upcCaseCode": "",
                      "prepackCode": "",
                      "caseGroupCode": "",
                      "skuNumber": "",
                      "unitPrice": "405.46",
                      "priceBasis": "",
                      "sellingPrice": 995,
                      "discountPercent": 0,
                      "shipDate": 060419,
                      "packSize": 1,
                      "inners": 1,
                      "itemDesc": "",
                      "itemWeight": "",
                      "itemReferenceId": 0,
                      "lotNumber": "",
                      "nrfSize": "",
                      "nrfColor": "",
                      "nrfDesc": "",
                      "unitSizeBuyer": "",
                      "itemColorBuyer": "",
                      "buyerStyleNo": "",
                      "countryOfOrigin": "",
                      "ticketType": "",
                      "mfgName": "",
                      "mfgCity": "",
                      "mfgCountry": ""
                    }
                  ],
                  "recordId": "",
                  "lineNo": "",
                  "sublineNo": "",
                  "originalLineNo": "",
                  "qty": 0,
                  "unitMeasure": "EA",
                  "upcCode": "",
                  "vendorNumber": "",
                  "unitSize": "",
                  "itemColor": "",
                  "customerItem": "",
                  "gtinNumber": "",
                  "upcCaseCode": "",
                  "prepackCode": "",
                  "caseGroupCode": "",
                  "skuNumber": "",
                  "unitPrice": "",
                  "priceBasis": "",
                  "sellingPrice": 0,
                  "discountPercent": 0,
                  "shipDate": 0,
                  "packSize": 0,
                  "inners": 0,
                  "itemDesc": "",
                  "itemWeight": "",
                  "itemReferenceId": 0,
                  "lotNumber": "",
                  "nrfSize": "",
                  "nrfColor": "",
                  "nrfDesc": "",
                  "unitSizeBuyer": "",
                  "itemColorBuyer": "",
                  "buyerStyleNo": "",
                  "countryOfOrigin": "",
                  "ticketType": "",
                  "mfgName": "",
                  "mfgCity": "",
                  "mfgCountry": "",
                  "extItemRef": "",
                  "custFld01Nam": "",
                  "custFld01Val": "",
                  "custFld02Nam": "",
                  "custFld02Val": "",
                  "custFld03Nam": "",
                  "custFld03Val": "",
                  "qtyShip": 0,
                  "qtyRemain": 0,
                  "itemPackCode": "",
                  "itemDimensionLength": 0,
                  "itemDimensionWidth": 0,
                  "itemDimensionHeight": 0,
                  "itemDimensionUom": "",
                  "cartonLenght": 0,
                  "cartonWidth": 0,
                  "cartonHeight": 0,
                  "cartonUom": "",
                  "itemStatus": "AC",
                  "statusReason": "backorder_cancel",
                  "statusDesc": "",
                  "qtyBackorder": 0,
                  "backorderDate": 0
                }
              ],
              "cartons": [
                {
                  "pack": [
                    {
                      "lineNo": 0,
                      "qtyPack": 0
                    }
                  ],
                  "recordId": "35210369",
                  "cartonCode": "",
                  "cartonQty": 0,
                  "palletId": 0,
                  "cartonWeight": 0,
                  "cartonLength": 0,
                  "cartonWidth": 0,
                  "cartonHeight": 0,
                  "cartonUom": "",
                  "cartonGroupCode": "",
                  "packSlipNumber": "",
                  "trackingNumber": ""
                }
              ],
              "billToAddress": {
                "type": "BT",
                "recordId": "BT",
                "locationNumber": "",
                "companyName1": "",
                "companyName2": "",
                "address1": "",
                "address2": "",
                "address3": "",
                "address4": "",
                "city": "",
                "state": "",
                "postalCode": "",
                "country": "",
                "dunsNumber": "",
                "dunsType": "",
                "contactPhone": "",
                "contactEmail": "",
                "contactFax": "",
                "contactOther": "",
                "locationCode": "",
                "consolidator": ""
              },
              "remitToAddress": {
                "type": "RE",
                "recordId": "RE",
                "locationNumber": "",
                "companyName1": "",
                "companyName2": "",
                "address1": "",
                "address2": "",
                "address3": "",
                "address4": "",
                "city": "",
                "state": "",
                "postalCode": "",
                "country": "",
                "dunsNumber": "",
                "dunsType": "",
                "contactPhone": "",
                "contactEmail": "",
                "contactFax": "",
                "contactOther": "",
                "locationCode": "",
                "consolidator": ""
              },
              "location": "0689",
              "shipToLocation": "",
              "releaseNumber": "",
              "contractNumber": "",
              "poType": "",
              "poCategory": "",
              "customerOrderNumber": "",
              "customerOrderRef": "",
              "promoteCode": "",
              "salesOrderNumber": "",
              "customerAccount": "",
              "buyerAccount": "",
              "buyerEmail": "",
              "vendor": "",
              "vendorNumberAp": "30",
              "poDate": 0,
              "requestedDeliveryDate": 0,
              "departmentNumber": "0149",
              "departmentDescription": "",
              "invoiceNumber": "SI19-000001",
              "invoiceDate": 20190528,
              "detailLineCount": 0,
              "orderCartons": 0,
              "orderWeight": 0,
              "orderVolume": 0
            }
          ],
          "pallets": [
            {
              "recordId": "",
              "palletId": 0,
              "palletCode": "",
              "palletType": "1",
              "cartonCount": 0,
              "palletWeight": 0,
              "totalWeight": 0,
              "weightUom": "",
              "palletLength": 0,
              "palletWidth": 0,
              "palletHeight": 0,
              "palletUom": "",
              "palletTiers": 0,
              "palletBlocks": 0,
              "packSize": 0,
              "inners": 0
            }
          ],
          "appointmentNumber": "",
          "billOfLading": "",
          "carrierCode": "",
          "carrierCustom": 0,
          "carrierService": "CX",
          "contactEmail": "",
          "contactFax": "",
          "contactName": "",
          "contactPhone": "",
          "containerCarrierCode": "",
          "containerType": "2B",
          "custWhsNumber": "",
          "deliveryDate": 20190528,
          "externalId": "",
          "fobCode": "CC",
          "fobLocation": "OR",
          "fobText": "",
          "importHandlingCode": "",
          "importLocCode": "",
          "importLocType": "",
          "importUnLocCode": "",
          "importVesselName": "",
          "importVoyageNumber": "",
          "masterBillOfLading": "",
          "packCodeContainer": "",
          "packCodeMaterial": "",
          "proNumber": "",
          "routingInstructions": "",
          "sealNumber": "",
          "shipDate": 20190528,
          "shipmentId": "SH19-000001",
          "shipMode": "",
          "shipTime": "",
          "tagId": 0,
          "trailerNumber": "",
          "transitTime": "",
          "transitTimeType": "",
          "transportTermsCode": "",
          "transportTermsQual": "",
          "vendor": "",
          "vendorNumberAp": "30"
        } 


1 个答案:

答案 0 :(得分:2)

查看数据后,看起来好像是两个问题。

  1. 您的订单和项目集合未关闭。
  2. 主json对象未关闭。

让我们从Order and Item集合开始:

Order and Item Problem Area

记录ID为3的订单中的项目集合未正确关闭。这将导致recordId 4成为记录3的项的子项的顺序。此外,订单记录本身也没有关闭(缺少花括号)。

要解决此问题,请在项目属性的末尾在逗号前放置一个方括号,然后将一个花括号。

How to Fix Order

结果:

Fixed Orders

现在我们已经清理了订单,在文件末尾只有几个大括号需要关闭。

order集合缺少其右方括号,并且主要的json对象缺少其右方括号:

Missing Closing Braces

结果:

Fixed Closing Braces

因此,这解决了结构性问题。正如@Gixabel所提到的,您还需要将shipDate的所有实例括起来,因为它们是日期的表示形式。