①可以用@RequestBody,接收json数据
@RequestBody(required = false)String str
②如果是比较复杂的json数据,可以使用JSON处理
先引入jar包:
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.3</version>
</dependency>
controller代码中写
public CommonResult updateDictionary(@RequestBody(required = false) String obj) {
//解析json数据
JSONObject json = JSON.parseObject(obj);
String description=json.getString("description");
Object dictionaryItemList1=json.get("dictionaryItemList");
...
}