jackson ignore null
public class MyDto {
@JsonInclude(Include.NON_NULL)
private String stringValue;
private int intValue; // standard getters and setters
}
jackson ignore null
public class MyDto {
@JsonInclude(Include.NON_NULL)
private String stringValue;
private int intValue; // standard getters and setters
}
jackson ignore values if empty
// 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;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us