Genson - exclude null properties of type Collection from serialization

157 Views Asked by At

I want all null properties to be ignored during serialization, as such, I have used the setSkipNull(true) in the GensonBuilder.

Genson genson = new GensonBuilder().setSkipNull(true).create();

However, this seems to work only for properties that are not Collections. When serializing a property of the type Collection, instead of excluding it, Genson includes it with a value of [] (empty array).

How to exclude properties of type Collection that are null?

0

There are 0 best solutions below