'Jackson Deserialisation Unrecognised Property issue on Nested Object
I have a Nested object which is mapped with json data. My object structure is as follows:
@JsonIgnoreProperties(ignoreUnknown = true)
public class Result {
public final int status;
public final int data;
@JsonProperty("error")
public final ErrorDetail errorData;
/** Error Detail */
public static class ErrorDetail {
public final int code;
public final String category;
public final String message;
public final String details;
}
// Respective Getters & Setters
}
My Json data looks like:
{
"status": 1,
"http_code": 400,
"data": 123,
"error": {
"code": 1001,
"category": "hello world",
"message": "Hello world",
"detail": null
}
}
Here as in json error section we are sending detail which is an unknown field so it should be ignored.
Note: json error section detail and Java Object ErrorDetail details are different and not related.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
