How can Jackson be configured to ignore a field value during serialization if that field\'s value is null.
For example:
public class SomeClass {
If in Spring Boot, you can customize the jackson ObjectMapper
directly through property files.
Example application.yml
:
spring:
jackson:
default-property-inclusion: non_null # only include props if non-null
Possible values are:
always|non_null|non_absent|non_default|non_empty
More: https://docs.spring.io/spring-boot/docs/current/reference/html/howto-spring-mvc.html#howto-customize-the-jackson-objectmapper