My client side application is built with Angular. I am attempting to send a List of Map
Below is the POJO definition :
public class ClasseurDTO {
private Map<String,String>[] ongletGeneralite;
public ClasseurDTO() {
}
public Map<String, String>[] getOngletGeneralite() {
return ongletGeneralite;
}
public void setOngletGeneralite(Map<String, String>[] ongletGeneralite) {
this.ongletGeneralite = ongletGeneralite;
}
@Override
public String toString() {
// parse ongletGeneralite object
String str = "";
for (Map<String, String> map : ongletGeneralite) {
for (Map.Entry<String, String> entry : map.entrySet()) {
str += entry.getKey() + " : " + entry.getValue() + " ,";
}
}
return "ClasseurDTO [ongletGeneralite=" + str + "]";
}
}
This is the typescript type def:
export type ClasseurDTO = {
ongletGeneralite: Map<string, string>[]
}
The method definition of the API :
@PostMapping("/public/observations/import-observations")
public ResponseEntity<String> importObservations(@RequestBody ClasseurDTO classeur) {
observationService.importObservations(classeur);
return ResponseEntity.ok().body("Importation terminée");
}
This is the http call:
importClasseur(classeur: ClasseurDTO): Observable<HttpResponse<{}>> {
console.log("importClasseur", classeur)
return this.http
.post(`${this.resourceUrlPublic}/import-observations`, classeur, { observe: 'response' });
}
Here is the log on the client side just before calling the API https://i.sstatic.net/BKwIw.png
Here is the payload in the network debug tool https://i.sstatic.net/9gBts.png
Can anyone identify where the issue lies?