On Tue, May 2, 2023 at 2:57 PM Laird Nelson <ljnel...@gmail.com> wrote: > > Given a JSON object with, say, three keys mapped to three values, is there a > way in Jackson 2.15 or later to annotate some setter method or constructor of > my POJO to receive the set of such keys, known and unknown? > > e.g. something like: > > @JsonCreator //... > public MyPojoConstructor(@JsonKeys /* maybe? */ Set<String> keys, ...) { > //... > } > > I'm aware I can do all sorts of fancy custom things involving deserializers, > @JsonAnySetter, etc. and composite the thing myself but this seemed like a > use case that maybe others have had, and that therefore might have a "one > shot" solution I'm simply overlooking.
I can't think of any simple way to do this, no. Appreciate you asking; there are many lesser known things that get omitted. But this isn't one, unfortunately. -+ Tatu +- > > Best, > Laird > > -- > 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+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jackson-user/640aab98-10e0-4d28-bfe1-cc3afcceb7afn%40googlegroups.com. -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jackson-user/CAL4a10h077pkqfLZwvyv7bNsewN5Ghd41x9TG9jDO6ygH5wFbQ%40mail.gmail.com.