@ApiOperation("test333ces")
@RequestMapping("test333")
public void test222(@RequestBody String str) {
Map data = (Map) JSON.parse(str);
Object body = data.get("body");
Object head = data.get("head");
JSONObject jsonObject = new JSONObject();
jsonObject.put("body", body);
jsonObject.put("head", head);
for (Map.Entry<String, Object> stringObjectEntry : jsonObject.entrySet()) {
String key = stringObjectEntry.getKey();
Object value = stringObjectEntry.getValue();
System.out.println(key + "----" + value);
}
}
postman请求参数:
{
"head":"{\"token\":\"1111\",\"content-type\":\"application/json\",\"id\":\"123123123123123\"}",
"body":"{\"name\":\"1123\",\"content\":\"·123·13·123·123\"}"
}
输出结果:
{"name":"1123","content":"·123·13·123·123"}
head----{"token":"1111","content-type":"application/json","id":"123123123123123"}
body----{"name":"1123","content":"·123·13·123·123"}