AutoBeanCodex.encode leaves properties with default values

I communicate with a web service through AutoBean , which are converted to JSON. The problem is that the web service expects every property of the JSON object to be present in the request, whereas AutoBeanCodex.encode() would seem to leave all the properties that have default values ​​(even though they are set explicitly )

Is there any way to enable these properties?

EDIT: Thomas's answer has already helped a lot, but it still leaves a little problem. Namely, an empty space ( List<Integer> in my case) is also swallowed, apparently, because the default value is an empty array, not null .

+4
source share
1 answer

A workaround is likely to be the use of wrapper types instead of primitive ones, for example. Boolean instead of Boolean , Integer instead of int ; Thus, the default value will be null , not false or 0 .

+5
source

All Articles