Jackson: deserializing null Strings as empty Strings
问题 I have the following class, that is mapped by Jackson (simplified version): public class POI { @JsonProperty("name") private String name; } In some cases the server returns "name": null and I would like to then set name to empty Java String. Is there any Jackson annotation or should I just check for the null inside my getter and return empty string if the property is null ? 回答1: You can either set it in the default constructor, or on declaration: public class POI { @JsonProperty("name")