I have the following endpoint
@PutMapping
ResponseEntity<MyObject> updateMyObject(@ModelAttribute MyObjectDTO myObjectDTO) {
...
}
And my DTO is
@Value
class MyObjetDTO {
...
List<ChildDTO> children;
}
And my child DTO is
@Value
class ChildDTO {
...
Long id;
String name;
}
In the UI, I send the request using form data (I need to do this since I have a multipart field in my DTO):
const formData = new FormData();
...
formData.append("children", JSON.stringify([]));
axios.put("http://localhost:8080/api, formData, {})...
I got this error on backend:
Failed to convert value of tyoe "java.lang.String" to required type "java.lang.List"