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

@JsonUnwrapped doesn't work on EnumMap #3215

Closed
Pr0methean opened this issue Jul 16, 2021 · 1 comment
Closed

@JsonUnwrapped doesn't work on EnumMap #3215

Pr0methean opened this issue Jul 16, 2021 · 1 comment

Comments

@Pr0methean
Copy link

When I annotate an EnumMap with @JsonUnwrapped, it's still serialized as a nested object rather than as multiple properties of the parent object. I recently ran into a case where this broke backward-compatibility (I was using the EnumMap to replace multiple fields of the value type). The only workaround seems to be to extend EnumMap rather than delegating to it, but this requires exposing put and putAll.

@cowtowncoder
Copy link
Member

Correct: @JsonUnwrapped only works for POJOs, and not for Maps as per #171. Closing this as duplidate.

As a work-around (until #171 is implemented), you might be able to use @JsonAnyGetter.

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

2 participants