When RESTeasy marshals a POJO into XML, it will skip null values by default: See Jaxb marshaller always writes xsi:nil (even when @XmlElement(required=false, nillable=true)).
However, when marshaling to JSON, null properties are included. Is there any way to force the JSON output to match the XML output?
To ensure that null values are not included in the JSON, the following annotation can be applied on the getter or public variable declaration: @JsonSerialize(include = Inclusion.NON_NULL)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With