mapper.setSerializationInclusion(Include.NON_NULL);
或者
@JsonInclude(Include.NON_NULL) class Foo { String bar; }