Add `@JsonIncludeProperties(propertyNames)` (reverse of `@JsonIgnoreProperties`)
See original GitHub issueIn some/many cases it’d be easier to just name properties to include, reverse of @JsonIgnoreProperties
. And similarly, it should be possible to define baselines by type as well as property overrides; and if ever we support inheritance-merging in class hierarchy, use similar merging strategies (merge vs replace).
NOTE: for this (2.12.0) implementation, no merging exists for class annotations – sub-class definitions will always simply replace super-class/super-interface definitions. Similarly there is no way to specify inclusions using “ConfigOverride” system, although ignoral is possible. Latter would likely be relatively easy to implement (so feel free to file a follow-up request); former (annotation merging) is a more difficult ask (but likewise feel free to file a feature request).
Issue Analytics
- State:
- Created 7 years ago
- Reactions:90
- Comments:33 (9 by maintainers)
Top GitHub Comments
Yes,
@JsonIncludeProperties(propertyNames)
is very useful!I also need @JsonIncludeProperties(propertyNames) Not only for sensitive fields but also for complex entity objects in which normally you don’t need other than few properties, example: