Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow use of @JsonIgnoreProperties for POJO-valued arrays, Collections #1060

Closed
cowtowncoder opened this issue Dec 29, 2015 · 2 comments
Closed
Milestone

Comments

@cowtowncoder
Copy link
Member

Currently it is possible to use @JsonIgnoreProperties not only on classes, but also on POJO-valued properties. If so, ignorals are combined with ones that class itself may have.

This can not, however, be used for Collections or arrays, as they have no properties to ignore. But if collection/map contents are POJOs, it would semantically make sense to allow usage for value type (elements), if possible.

It might also make sense to allow similar approach for Map values, but there is the problem with ambiguity, as Map keys can be considered properties, and currently functionality does support ignoral.

@cowtowncoder
Copy link
Member Author

And in fact I think this actually already works for Maps, ignoring entries as annotated. So it'd only work on arrays, Collections.

@cowtowncoder cowtowncoder added this to the 2.9.0 milestone Apr 24, 2018
@cowtowncoder
Copy link
Member Author

Interesting. Should have actually tested earlier, but this DOES work at least on 2.9.
So: @JsonIgnoreProperties annotation on Collection or array-valued property should work, as long as POJO type is declared. So no further work needed. If there are gaps please report as new issues.

@cowtowncoder cowtowncoder changed the title Consider possibility of allowing use of @JsonIgnoreProperties for POJO values of Collections, Maps Allow use of @JsonIgnoreProperties for POJO-valued arrays, Collections Apr 24, 2018
cowtowncoder added a commit that referenced this issue Apr 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant