I want to handle json request for List of Object and Object it self in the same Spring controller. Below is the exact example.
Json Request for Single Object:
{"data":{"prop":"123456","prop2":"123456"}}
Json Request for List of Objects:
{"data":[{"prop":"123456","prop2":"123456"},{"prop":"123456","prop2":"123456"}]}
My Controller is as follow.
@PostMapping(path="/path")
public @ResponseBody String getSomething(@RequestBody Input data){
return service.getSomething(data);
}
I want to handle both of this requests in a single spring controller.
Appreciate your help. Thanks.