jay
0
Q:

jackson ignore value if null

public class MyDto {     
	@JsonInclude(Include.NON_NULL)
  	private String stringValue;
  
  	private int intValue;     // standard getters and setters
}
1
// every Value

@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class ObjectWithoutEmpty {

  	// only not empty Values get included 
    @JsonProperty("propertyOne")
    private String propertyOne;

  	// only not empty Values get included 
    @JsonProperty("propertyTWO")
    private String propertyTWO;

}

// one property


public class ObjectWithoutEmpty {

  	// only non empty Values get included 
  	@JsonInclude(JsonInclude.Include.NON_EMPTY)
    @JsonProperty("propertyOne")
    private String propertyOne;
  
	// empty Values get included 
    @JsonProperty("propertyTWO")
    private String propertyTWO;

}
1
public class Object {
  
    @JsonInclude(NON_NULL)
    @JsonProperty("property")
    private String property;
  
}
2

New to Communities?

Join the community