I use spring boot 2, In a dto have
@JsonInclude(value=Include.NON_EMPTY, content=Include.NON_NULL)
private Map<String, String> settings;
I get this error
org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot construct instance of
java.util.LinkedHashMap
(although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value (''); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance ofjava.util.LinkedHashMap
(although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('')
from the client when i check what is sent, i see
settings: ""
why i get this error?
Edit
public Map<String, String> getSettings() {
settings = settings == null ? new LinkedHashMap<>() : settings;
return settings;
}
public void setSettings(Map<String, String> settings) {
this.settings = new LinkedHashMap<>(settings);
}
web part
transfort come from: https://github.com/dominicbarnes/form-serialize
var form = transForm.serialize('#form'); form = JSON.stringify(form);
Tried to add on the field
@JsonInclude(value=JsonInclude.Include.CUSTOM, valueFilter=FilterMap.class)
My class
public class FilterMap {
@Override
public boolean equals(Object other) {
return true;
}
}
same problem