附录:JSON 格式
{
"ZVP_GRDATA": [
{
"EBELN": "11",
"EBELP": "1",
"MBLNR": "1",
"MJAHR": "1",
"ZEILE": "1",
"EINDT": "1",
"MENGE": "1",
"DMBTR": "1",
"BUDAT_MKPF": "1",
"MEINS": "1",
"PROCESSDATE": "1",
"PROCESSTIME": "1",
"ZSTATUS": "1"
}
]
}
public String getBodyString(BufferedReader br) {
String inputLine;
String str = "";
try {
while ((inputLine = br.readLine()) != null) {
str += inputLine;
}
br.close();
} catch (IOException e) {
System.out.println("IOException: " + e);
}
}
public String selectVendorOrder() throws IOException {
String node = getBodyString(request.getReader());
ZvpGrDataDto dto = new ZvpGrDataDto();
JSONObject fromObject = JSONObject.fromObject(node);
JSONArray array = fromObject.getJSONArray("ZVP_GRDATA");
List<ZvpGrData> zvpGrDataList = new ArrayList<ZvpGrData>();
for (int i = 0; i < array.length(); i++) {
ZvpGrData b = (ZvpGrData) JSONObject.toBean(
(JSONArray.fromObject(array.toString()).getJSONObject(i)),
ZvpGrData.class);
}
}