jackson java default ignore include null value from json code example
Example 1: jackson ignore values if empty
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class ObjectWithoutEmpty {
@JsonProperty("propertyOne")
private String propertyOne;
@JsonProperty("propertyTWO")
private String propertyTWO;
}
public class ObjectWithoutEmpty {
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonProperty("propertyOne")
private String propertyOne;
@JsonProperty("propertyTWO")
private String propertyTWO;
}
Example 2: jackson ignore value if null
public class Object {
@JsonInclude(NON_NULL)
@JsonProperty("property")
private String property;
}