Reputation: 61
I have a rest service exposed using spring boot rest controller but with the response i'm sending object's properties those has null values.
For ex : ReponseEntity.ok(list) and that list consist of Objects A with lot of null properties.
Is there an easy way of excluding those null properties with spring boot tools?
Upvotes: 3
Views: 2921
Reputation: 483
You can try this in application.properties file
spring.jackson.default-property-inclusion=non_null
or you can try following annotation in class level or property level
@JsonInclude(JsonInclude.Include.NON_NULL)
Upvotes: 4