从前台接收json封装的list数据,在后台接收时一直报错,com.alibaba.fastjson.JSONObject cannot be cast to xxx,
使用这种方式接收可以接收
1 1 @RequestMapping(value = "/insertUser", method = RequestMethod.POST) 2 2 public ResultT insertUser(@RequestBody Map<String,List<User>> map){ 3 3 List<User> userList = map.get("insertUserList"); 4 4 } 5 5 6 6 //前台json格式 7 7 { 8 8 "insertUserList": [ 9 9 { 1010 "firstName": "Brett", 1111 "lastName": "McLaughlin", 1212 "email": "aaaa" 1313 }, 1414 { 1515 "firstName": "Jason", 1616 "lastName": "Hunter", 1717 "email": "bbbb" 1818 }, 1919 { 2020 "firstName": "Elliotte", 2121 "lastName": "Harold", 2222 "email": "cccc" 2323 } 2424 ] 2525 }