I need my endpoint to return data in follow json format:
{
"code": "SUCCESS",
"message": "SUCCESS",
"errors": null,
"data": []
}
Here is my controller code:
@GetMapping(value = "/productSubcategories", produces = MediaType.APPLICATION_JSON_VALUE)
public Flux<MyDTO> getMyObjects() {
return myObjectService.getAll()
.map(myObject -> modelMapper.map(productSubcategory, MyObject.class));
}
What is the best way to put wrap all the MyDTO objects in the "data" section of json response?