Reputation: 3112
I have a container for nested objects like:
class A {
private Type type;// can message or invite
private Notification notification;
}
and classes
abstract class Notification {}
class Message extends Notification {}
class Invite extends Notification {}
When I serialize List to JSON all works fine, but I can make deserialization with ObjectMapper because jackson doesn't know the the instance type of Notification, that are stored in type field. Question is it possible to deserialize with ObjectMapper?
Upvotes: 0
Views: 3481
Reputation: 1348
I also struggled with this issue but there is a nice blog item here;
http://www.cowtowncoder.com/blog/archives/2010/03/entry_372.html
This should explain everything
Upvotes: 3