对于列表中的单个对象,webservice 将 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
}
正如您在此处看到的,如果只有一个位置,webservice 将 json 中的 Locations 字段视为单个对象,而当有多个数据时,球衣将字段格式化为数组,并在后面加上“[]”方括号
"Locations": [{
"locationDetails": {
}
}];
我试图找到一种解决方案,将位置作为单个元素的列表,但没有成功。任何人都可以帮我解决这个问题。