标签:nal date class ica esc ppi post请求 catch use
1.post请求 Headers: Content-Type application/json
{
"taskId":"1000001161",
"createUser":"siwenhu",
"data":"{\"dataList\":[{\"productDesc\":\"接入\",\"createUser\":\"siwenhu|jackchen\",\"serviceId\":\"12300211\",\"sysName\":\"WMKT-RULE\",\"type\":\"1\",\"subsystem_id\":\"1157\",\"filter\":\"DX01|FY02\",\"productCd\":\"A1110000\"}]}",
"createDate":"2019-12-04 11:37:09",
"externalId":"11037540",
"flowId":"10014002"
}
2.后台对象接收
PostMapping("/wen")
@ResponseBody
public String testJson(@RequestBody Message message){
JSONObject data_json = null;
JSONArray data_json_array = null;
try {
data_json = new JSONObject(message.getData());
data_json_array = data_json.getJSONArray("dataList");
} catch (Exception e) {
}
System.out.println(data_json_array.length());
try {
System.out.println(data_json_array.get(0).toString());
} catch (JSONException e) {
e.printStackTrace();
}
return message+"";
}
3.javabean的设置
public class Message {
private String externalId;
private String createUser;
private String data;
private String createDate;
private String flowId;
private String taskId;
}
标签:nal date class ica esc ppi post请求 catch use
原文地址:https://www.cnblogs.com/liuyi13535496566/p/11984798.html