jackson-databind icon indicating copy to clipboard operation
jackson-databind copied to clipboard

Support `@JsonInclude` for `Collection`

Open JooHyukKim opened this issue 1 month ago • 2 comments

Describe your Issue

Currently @JsonInclude only works for limited set of types --see @JsonInclude javaDoc for more detail.

Goal is to support Collection type as well.

JooHyukKim avatar Oct 29 '25 14:10 JooHyukKim

I think the big question is backwards compatibility: given many developers set global inclusion defaults, making Collections follow @JsonInclude could cause significant breakages.

So there probably needs to be MapperFeature for enabling this behavior (conceptually SerializationFeature, but that can be changed on per-call (mapper.writeValue()) basis, and if we cache serializers this couldn't be supported).

cowtowncoder avatar Dec 04 '25 03:12 cowtowncoder

Makes sense! Will modify the PR to support the enable disable feature.

JooHyukKim avatar Dec 05 '25 06:12 JooHyukKim