0
我有一個定義JSON結構的頂點代碼。我想就如何使用Apex將值分配給JSON上的字符串字段尋求建議。的JSON將具有陣列(PackageData),其包含應該包含值Json/Apex:將值分配給Json數組上的節點
字段的Apex代碼:
public class Shipment{
public PackageData[] PackageData;
}
public class PackageData{
public Packaging Packaging;
public Dimensions Dimensions;
public PackageWeight PackageWeight;
}
public class Packaging{
public string Code;
}
public class Dimensions{
public UnitOfMeasurement UnitOfMeasurement;
public string Length;
public string Width;
public string Height;
}
public class UnitOfMeasurement{
public string Code;
}
public class PackageWeight{
public UOM UOM;
public string Weight;
}
public class UOM{
public string Code;
}
JSON:
{
"PackageData": [
{
"Packaging": {
"Code": ""
},
"Dimensions": {
"UnitOfMeasurement": {
"Code": ""
},
"Length": "",
"Width": "",
"Height": ""
},
"PackageWeight": {
"UOM": {
"Code": ""
},
"Weight": ""
}
}
]
}