Ok: this is where distinction between `value` and `content` differ,
for Maps (and referential types). I think your question is similar to
one I had when deciding earlier that 2 properties are needed.
Basic `value`, like
@JsonInclude(Include.NON_EMPTY)
would only exclude "map" itself, and only if it has no elements on Java side.
It's, I think, your Option A.
But if adding `content`, like
@JsonInclude(value = Include.NON_EMPTY, content = Include.NON_EMPTY)
serializer should instruct `NON_EMPTY` check for Map values as well,
and in case of empty `List` or array, that element would be excluded;
and then `Map`, too, would be excluded if nothing was output.
And this would achieve Option B I think.
Does this make sense?
Handling gets rather tricky here, partly due to difference between
contents and vlaue itself; and partly since handling of emptiness is
very different between POJOs and Maps.
Further, although ideally `content=Include.NON_EMPTY` SHOULD work for
Collections and Arrays, currently it does not; only `value` is
supported. This does not matter in your use case, but means that
functionality is not fully orthogonal.
-+ Tatu +-
> --
> You received this message because you are subscribed to the Google Groups
> "jackson-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
jackson-user...@googlegroups.com.
> To post to this group, send email to
jackso...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.