Issue
I have added @JsonInclude(Include.NON_NULL)
annotation on Response class.
@JsonInclude(Include.NON_NULL)
public class Response {
@JsonProperty
private String message;
// getter-setters
}
If the value is null the property does not include in JSON
But still I am getting this property as a NULL.
{
"message": null
}
What can be the reason ? Am I missing anything ?
Solution
I tried
@JsonSerialize(include = Inclusion.NON_NULL)
intead of
@JsonInclude(Include.NON_NULL)
and it worked as expected.
Answered By - Ninad Pingale
Answer Checked By - Willingham (JavaFixing Volunteer)