To explain my issue, let's say that I'm retrieving the following OData V2 Entity:
{
"d": {
"EmployeeID": 1,
"LastName": "Davolio",
"FirstName": "Nancy",
"Orders": {
"results": [
{
"OrderID": 10258
}
]
},
"Territories": {
"results": [
{
"TerritoryID": "06897"
}
]
}
}
}
And I have the corresponding model Class:
@JsonRootName(value = "d")
public class Employee {
@JsonProperty("EmployeeID")
private int employeeId;
@JsonProperty("LastName")
private String lastName;
@JsonProperty("FirstName")
private String firstName;
@JsonProperty("Orders")
private List<Order> orders;
@JsonProperty("Territories")
private List<Territory> territories;
...
}
As expected the exception com.fasterxml.jackson.databind.exc.MismatchedInputException is being triggered because the "Orders" and "Territories" collections are actually within the property "results", as the OData V2 states.
Do you guys have any idea how to ignore the nested "results" property and get the lists straight away? Is a custom deserializer or wrapper class really needed in this case?
Thanks!