How to map unknown JSON properties with Jackson? - Layer4
For a current project, I need to map a JSON object that have some known fields, and some "dynamics" fields. I don't want to ignore these fields, just to get them in a map inside my bean. After digging for 20 minutes, I finally found the right annotations to use: @JsonAnyGetter and @JsonAnySetter.
@JsonAnySetter is a simple marker that can be used to define a two-argument method (first argument name of property, second value to set), to be used as a "fallback" handler for all otherwise unrecognized properties found from JSON content.
Read full article from How to map unknown JSON properties with Jackson? - Layer4
No comments:
Post a Comment