Skip to content

How can I deserialize json to interface #112

Answered by pjfanning
DoneSpeak asked this question in Q&A
Discussion options

You must be logged in to vote

Discussions is not a feature to get coding advice. Please read https://docs.github.com/en/discussions

Stackoverflow.com is probably the best way to discuss issues about why your code is not working as you expect. The issue you are hitting here is likely down to the fact that your interface does not expose a way to set the name. Please understand that deserialization requires Jackson to use Java methods to create object instances and set values on those instances. Your interface has neither.

You should read https://www.baeldung.com/jackson-annotations#jackson-polymorphic-type-handling-annotations

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by DoneSpeak
Comment options

You must be logged in to vote
2 replies
@DoneSpeak
Comment options

@cowtowncoder
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants