Reputation: 69
I use JBoss EAP 7.1 with JAVA EE. I can exclude null fields in response using @JsonInclude(JsonInclude.Include.NON_NULL)
annotation under class all filed.
Does exist way to exclude globally (in all project) null values in all objects that resteasy return in response, for example here :
Response.status(Response.Status.OK).entity(objet).build()
Upvotes: 1
Views: 1964
Reputation: 38635
You need to configure ObjectMapper
instance in your app:
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(Include.NON_NULL);
See also:
Upvotes: 3