@RequestBody Jackson to parse the complex incoming value of a pit; Jackson analytic Iteration Group; Jackson multiple array; Jakson array

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.