I have a spring boot API . The call is as below:
@PostMapping("/call-back")
public BaseResponse<String> callBack(@RequestBody CallBackDTO callbackRequest) {
}
the CallBackDTO object is as below:
public class CallBackDTO {
private String msgRefNo;
private Object Message;
}
when I pass in this json request, its like below:
{
"msgRefNo": "202502070000000137"
"Message": {
//unknown, random stuff.
}
}
- I am able to receive msgRefNo. But I cant detect Message.How do i save the Message field, with undefined format ?
Map<String, Object>then same problem will arise again. you can make use of jackson(comes builtin with mvc) or gson(google's library). These 2 libraries help java devs to read data from Json, when type is thing that you are not sure about.