1

リスト内の単一のオブジェクトの場合、Web サービスは json を次のようにフォーマットしています。

{
  "statusCode": "SUCCESS",
  "LocationData": {
    "userID": "85010352",
    "salesOrganisation": "AU10",
    "hospitalAccount": "0001016425",
    "Locations": {
      "locationDetails": {
        "consignmentFlag": "0",
        "itemData": {
          "itemDetails": [
     {
              "additionalConsignmentComment": "null",
              "boQuantity": "0",
              "initialConsignmentComment": "null",
              "materialCode": "SPB1233G",
              "maxExpectedStockLevel": "0",
              "maxPAR": "null",
              "minPAR": "1",
              "newBarcode": "",
              "persistentItemNote": "",
              "shelfSequenceData": {
                "shelfSequenceDetails": {
                  "countSequence": "81"
                }
              },
              "totalStockQuantity": "12",
              "vendorCode": "USAU"
            },
            {
              "additionalConsignmentComment": "null",
              "boQuantity": "0",
              "initialConsignmentComment": "null",
              "materialCode": "SPB5142G",
              "maxExpectedStockLevel": "0",
              "maxPAR": "null",
              "minPAR": "1",
              "newBarcode": "",
              "persistentItemNote": "",
              "shelfSequenceData": {
                "shelfSequenceDetails": {
                  "countSequence": "82"
                }
              },
              "totalStockQuantity": "10",
              "vendorCode": "USAU"
            },
            {
              "additionalConsignmentComment": "null",
              "boQuantity": "0",
              "initialConsignmentComment": "null",
              "materialCode": "SPB5223G",
              "maxExpectedStockLevel": "0",
              "maxPAR": "null",
              "minPAR": "6",
              "newBarcode": "",
              "persistentItemNote": "",
              "shelfSequenceData": {
                "shelfSequenceDetails": {
                  "countSequence": "83"
                }
              },
              "totalStockQuantity": "15",
              "vendorCode": "USAU"
            },
            {
              "additionalConsignmentComment": "null",
              "boQuantity": "0",
              "initialConsignmentComment": "null",
              "materialCode": "SPB5633G",
              "maxExpectedStockLevel": "0",
              "maxPAR": "null",
              "minPAR": "1",
              "newBarcode": "",
              "persistentItemNote": "",
              "shelfSequenceData": {
                "shelfSequenceDetails": {
                  "countSequence": "84"
                }
              },
              "totalStockQuantity": "11",
              "vendorCode": "USAU"
            }
          ]
        },
        "locationAccount": "102021EYE",
        "locationCountDate": "2013/07/25"
      }
    }
  },
  "ItemBarCodeData": null
}

ここでわかるように、場所が 1 つしかない場合、Web サービスは json の Locations フィールドを単一のオブジェクトとして扱います。複数のデータがある場合、ジャージはフィールドを配列としてフォーマットし、後に「[]」角括弧を配置します

"Locations": [{
      "locationDetails": {
       }
     }];

場所を単一要素のリストとして作成する解決策を見つけようとしましたが、成功しませんでした。

4

0 に答える 0