Deserializing attributes of same name but different types in Jackson?
问题 I have a REST API which returns a JSON response as: { "channel" : "JHBHS" } and sometimes it returns: { "channel": { "id": 12321, "name": "Some channel" } } I have a POJO like: public class Event { private String channel; @JsonProperty("channel") private Channel channelObj; } public class Channel { private int id; private String name; } So, is there a way (other than writing your own custom deserializer ) in Jackson2 which will help me map channel in JSON to String type when it's a String and