import com.alibaba.fastjson.JSONObject;1 @PostMapping(value = "/insert-update")
2 public ResponseData inserCase(@RequestBody Map<String, Object> param){
3 List<Model> list = JSONObject.parseArray(param.get("xxxx").toString(), Model.class);
4 Model model = JSONObject.parseObject(param.get("xxxxx").toString(), model.class);
后台接收前端传来的集合参数
前端传递参数类型1 let arr: string[] = [];
2 const params = {
3 xxxxx: JSON.stringify(arr),
4 ....
5 };
1 let arr = [1,2,3];
2 JSON.stringify(arr);//'[1,2,3]'
3 typeof JSON.stringify(arr);//string
4
5 let string = '[1,2,3]';
6 console.log(JSON.parse(string))//[1,2,3]
7 console.log(typeof JSON.parse(string))//object