spring中处理json
1.使用fastJson
2.controller层
@PostMapping("")
@ResponseBody
public BaseResponse jsonFunction(@RequestBody String jsonData){
BaseResponse baseResponse = new BaseResponse();
JSONObject data = JSONObject.parseObject(jsonData);
//处理基本类型
Integer articleId = data.getInteger("articleId");
String title = data.getString("title");
//处理List
List<ArticleVO> list = JSONArray.parseArray (jsonData, ArticleVO.class);
return baseResponse;
}