Jackson use JsonSerialize.Inclusion.NON_NULL except for one class
@user1433372, JsonInclude is an annotation only for Jackson 2.x.
in Jackson 1.9
@JsonSerialize(include=JsonSerialize.Inclusion.NON_EMPTY)
is the same in Jackson 2.x as
@JsonInclude(JsonInclude.Include.NON_EMPTY)
With Jackson 1.9 is used @JsonSerialize(include= JsonSerialize.Inclusion.ALWAYS)
@JsonSerialize(include=Include.ALWAYS)
did not compile.
With Jackson 1.x you can use @JsonSerialize(include = Inclusion.ALWAYS)
and with Jackson 2.x you can use @JsonInclude(Include.ALWAYS)
. These annotations will override the default config from your ObjectMapper
.