I use java 11 and spring. I try to send two objects via post to the controller, but I get an error.
Here the controller:
@PostMapping("/new_info/buildingData")
public Map<String, List<Buildings>> getBuildingData(
@RequestBody Boolean isIncluded,
@RequestBody BuildingData buildingData
) {
Map<String, List<Buildings>> results = new HashMap<>();
results.put("results", buildingService.findBuildingDataByInfoId(BuildingData, isGood));
return results;
}
Here the data that I send via swagger:
{
"isIncluded": true,
"buildingData": {
"id": "1232165",
"name": "Tir44",
"description": "West side road 45",
}
}
When I try to hit the function above I get this error:
c.p.s.utility.ExceptionHandlerAdvice : <=== Exception: JSON parse error: Cannot deserialize instance of `java.lang.Boolean` out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.Boolean` out of START_OBJECT token
Any idea why I get the error and how to fix it?