I have an api endpoint with request body like this.
{
"employeeId" : "1234",
"empName" : "John"
}
The fields are dynamic. So instead of creating a request class I am passing request body as HashMap<String, String> as below.
@PostMapping
public ResponseEntity<EmployeeResponse> getEmployees(@RequestBody HashMap<String, String> queryParams){
}
Now my requirement is to add something like this in the request body along with other dynamic fields.
{
"empAwardsReceived" : ["On the spot award", "Best employee award"]
}
How can we handle this? Can someone please help?
I changed RequestBody from HashMap<String, String> to HashMap<String, Object> and it worked.