I'm comunicating with a web service via AutoBean
s that 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()
seemingly leaves out all properties that have their default values (despite those being set explicitly).
Is there a way to include those properties too?
EDIT: Thomas' answer already helped a lot, but it still leaves a little problem. Namely an empty array (List<Integer>
in my case) is swallowed as well, apparently because the default value there would be the empty array and not null
.
A workaround would probably be to use the wrapper types instead of the primitive ones, e.g.
Boolean
instead ofboolean
,Integer
instead ofint
; that way, the default value would benull
rather thanfalse
or0
.