且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Jackson:将空字符串反序列化为空字符串

更新时间:2023-02-25 22:59:32

您可以在默认构造函数中或在声明时设置它:

You can either set it in the default constructor, or on declaration:

public class POI {
    @JsonProperty("name")
    private String name; 

    public POI() {
        name = "";
    }
}

public class POI {
    @JsonProperty("name")
    private String name = "";
}