Jackson renames primitive boolean field by removing 'is'

后端 未结 10 805
渐次进展
渐次进展 2020-11-27 12:07

This might be a duplicate. But I cannot find a solution to my Problem.

I have a class

public class MyResponse implements Serializable {

    private          


        
10条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-27 12:40

    You can change primitive boolean to java.lang.Boolean (+ use @JsonPropery)

    @JsonProperty("isA")
    private Boolean isA = false;
    
    public Boolean getA() {
        return this.isA;
    }
    
    public void setA(Boolean a) {
        this.isA = a;
    }
    

    Worked excellent for me.

提交回复
热议问题