java exclude if null code example
Example 1: jackson ignore null
public class MyDto {
@JsonInclude(Include.NON_NULL)
private String stringValue;
private int intValue; // standard getters and setters
}
Example 2: jackson ignore value if null
public class Object {
@JsonInclude(NON_NULL)
@JsonProperty("property")
private String property;
}