I'm retrieving JSON back from a web service. Sometimes the property in the JSON would return as an object, and other times it's an array of the object. How can I write the Java class that I'm deserializing into to deserialize properly this property with Jackson's ObjectMapper
? Can I do with the ObjectMapper to help with this?
JSON with object:
"results": {
"account": {
"expiration": "2012-11-16"
}
}
JSON with collection
"results": {
"account": [{
"expiration": "2012-11-16"
}]
}