從前臺接收json封裝的list數據,在後臺接收時一直報錯,com.alibaba.fastjson.JSONObject cannot be cast to xxx,json
使用這種方式接收能夠接收app
1 @RequestMapping(value = "/insertUser", method = RequestMethod.POST) 2 public ResultT insertUser(@RequestBody Map<String,List<User>> map){ 3 List<User> userList = map.get("insertUserList"); 4 } 5 6 //前臺json格式 7 { 8 "insertUserList": [ 9 { 10 "firstName": "Brett", 11 "lastName": "McLaughlin", 12 "email": "aaaa" 13 }, 14 { 15 "firstName": "Jason", 16 "lastName": "Hunter", 17 "email": "bbbb" 18 }, 19 { 20 "firstName": "Elliotte", 21 "lastName": "Harold", 22 "email": "cccc" 23 } 24 ] 25 }