[英]How to send JSON from postman for a custom VO
我應該從 Postman 發送的 JSON 格式是什么才能正確地將它映射到我的 rest 控制器。
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 標頭作為內容類型
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.