@RequestBody jackson解析复杂的传入值的一个坑;jackson解析迭代数组;jackson多重数组;jakson数组
2021-07-11 00:04
标签:解析 一个 col ToJson span and ide 技术分享 hide 一、实际开发的一个问题。 传入一个json数组,数组中还嵌套数组,运用springboot+Jpa框架,@RequestBody注解传入数据 Controller 传入对象的json格式 二、传入后总是接收不到 "ModularIdNum": [ ModularIdNum 建立在实体类中,是不能大写的,需要小写modularIdNum "modularIdNum": [ 实体类对应 @RequestBody jackson解析复杂的传入值的一个坑;jackson解析迭代数组;jackson多重数组;jakson数组 标签:解析 一个 col ToJson span and ide 技术分享 hide 原文地址:https://www.cnblogs.com/liuyangfirst/p/9552939.html1 @ApiOperation(value = "添加订单", notes = "添加订单", httpMethod = "POST")
2 @RequestMapping("/addOrder")
3 public BaseResource addOrder(@RequestBody BaseSingleList baseSingleList) {
4 log.info("controller传入数据:" + gson.toJson(baseSingleList));
5
6 return orderService.addOrder(baseSingleList);
7
8 }
1 {
2 "singleOrderList": [
3 {
4 "orderName": "wyy",
5 "orderPhone": "186683812781",
6 "contact": "wyy",
7 "telephony": "187738122781",
8 "provinceId": 123,
9 "cityId": 1-302,
10 "regionId": 19930203,
11 "address": "33363",
12 "userId": "32689d13465242dfad62ee1cdbf34d887",
13 "serieId": "94",
14 "trueTime": "2018-12-02",
15 "overTime": "2019-12-01",
16 "monthlyRent": 5000,
17 "dateCount": 18,
18 "packageId": "34ea0a3fb9a4496bab90488727ad6c57a09b",
19 "total": "3000000",
20 "ModularIdNum": [
21 {
22 "itemId": "b20f1c33256ae64ad576bec51e85d821eae1",
23 "modularNum": 1
24 }
25 ],
26 "isRentAndSell": 11110,
27 "applicationArea": null,
28 "remark": null,
29 "instruPurpose": null
30 }
31 ]
32 }
{
"itemId": "b20f1c33256ae64ad576bec51e85d821eae1",
"modularNum": 1
}
]
这段数组的值,本来以为是@RequestBody无法解析问题,最后发现是字段的大小写问题
{
"itemId": "b20f1c33256ae64ad576bec51e85d821eae1",
"modularNum": 1
}
]
文章标题:@RequestBody jackson解析复杂的传入值的一个坑;jackson解析迭代数组;jackson多重数组;jakson数组
文章链接:http://soscw.com/index.php/essay/103448.html