从前台接收json封装的list数据,在后台接收时一直报错,com.alibaba.fastjson.jsonobject cannot be cast to xxx,
使用这种方式接收可以接收
1 @requestmapping(value = "/insertuser", method = requestmethod.post)
2 public resultt insertuser(@requestbody map> map){
3 list 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 }
如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!