Blog

Deserialising Abstract Classes with Jackson
Jackson can automatically detect the relevant abstract class to initialise when parsing some JSON if you give it a little bit of help. There are multiple methods Jackson can use to detect and indicate the class it should use but the method I have chosen is to tell it to look for a type field. Consider the following json snippets { "id": "123", "type": "name", "name": "Alex" } { "id": "345", "type": "value", "value": 123. More...