如何从邮递员发送 JSON 以获取自定义 VO
How to send JSON from postman for a custom VO
我应该从 Postman 发送的 JSON 的格式是什么才能正确地将其映射到我的休息控制器。
TfundsVO :
BigDecimal accountNum
String accountName
BigDecimal accountBal
@GetMapping("/")
public ResponseEntity<Object> getFunds(@RequestBody TfundsVO tfundsVO) {
System.out.println(tfundsVO.getAccountNum());
}
使用的样本 JSON:
{
"tfundsVO": [
{
"accountName": "Sam"
}
]
}
当我从 Postman 尝试上述 JSON 时,调用转到 getFunds 方法,但是 TfundsVO 中的所有值都是 NULL。
只发送没有数组的负载
{ "account name": "test" }
并请添加 application/json header 作为 content-type
我应该从 Postman 发送的 JSON 的格式是什么才能正确地将其映射到我的休息控制器。
TfundsVO :
BigDecimal accountNum
String accountName
BigDecimal accountBal
@GetMapping("/")
public ResponseEntity<Object> getFunds(@RequestBody TfundsVO tfundsVO) {
System.out.println(tfundsVO.getAccountNum());
}
使用的样本 JSON:
{
"tfundsVO": [
{
"accountName": "Sam"
}
]
}
当我从 Postman 尝试上述 JSON 时,调用转到 getFunds 方法,但是 TfundsVO 中的所有值都是 NULL。
只发送没有数组的负载
{ "account name": "test" }
并请添加 application/json header 作为 content-type