One, the actual development of a problem.
A JSON array is passed in, and arrays are nested, using the SPRINGBOOT+JPA framework to @RequestBody annotations to the incoming data
Controller
1 @ApiOperation (value = "Add Order", notes = "Add Order", HttpMethod = "POST")2 @RequestMapping ("/addorder" )3public baseresource addorder (@RequestBody basesinglelist basesinglelist) { 4 Log.info ("Controller Incoming data:" + Gson.tojson (basesinglelist)); 5 6 return Orderservice.addorder (basesinglelist); 7 8 }
View Code
JSON format for incoming objects
1 {2"Singleorderlist": [3 {4"Ordername": "Wyy",5"Orderphone": "186683812781",6"Contact": "Wyy",7"Telephony": "187738122781",8"Provinceid": 123,9"Cityid": 1-302,Ten"RegionID": 19930203, One"Address": "33363", A"UserId": "32689d13465242dfad62ee1cdbf34d887", -"Serieid": "94", -"TrueTime": "2018-12-02", the"Overtime": "2019-12-01", -"Monthlyrent": 5000, -"Datecount": 18, -"PackageId": "34ea0a3fb9a4496bab90488727ad6c57a09b", +"Total": "3000000", -"Modularidnum": [ + { A"ItemId": "B20F1C33256AE64AD576BEC51E85D821EAE1", at"Modularnum": 1 - } - ], -"Isrentandsell": 11110, -"Applicationarea":NULL, -"Remark":NULL, in"Instrupurpose":NULL - } to ] +}
View Code
Second, always receive after the incoming
"Modularidnum": [
{
"ItemId": "B20F1C33256AE64AD576BEC51E85D821EAE1",
"Modularnum": 1
}
]
The value of this array, originally thought to be @requestbody unresolved problem, finally found to be the case of the field of the problem
Modularidnum is built into the entity class, it cannot be capitalized and requires lowercase modularidnum
"Modularidnum": [
{
"ItemId": "B20F1C33256AE64AD576BEC51E85D821EAE1",
"Modularnum": 1
}
]
Entity class correspondence
@RequestBody Jackson to parse the complex incoming value of a pit; Jackson analytic Iteration Group; Jackson multiple array; Jakson array