简体   繁体   中英

How to send JSON from postman for a custom VO

What is the format of JSON that I should be sending from Postman to correctly map it to my rest controller.

TfundsVO :
BigDecimal accountNum
String accountName
BigDecimal accountBal



@GetMapping("/")
public ResponseEntity<Object> getFunds(@RequestBody TfundsVO tfundsVO) {
    System.out.println(tfundsVO.getAccountNum());
}

Sample JSON used:

{
    "tfundsVO": [
     {
        "accountName": "Sam"
     } 
  ]
}

When I tried the above JSON from Postman, call goes to the getFunds method, however all the values in TfundsVO are NULL.

Just send the payload without an array

{ "account name": "test" }

And please add an application/json header as a content-type

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM