I've a JSON in the following format:
{
"FileStatuses": {
"FileStatus": [{
"accessTime": 1479784299020,
"type": "FILE"
},
{
"accessTime": 1475421868510,
"type": "FILE"
}
]
}
}
I'm trying to deserialize it using the following class:
@Value.Immutable
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonSerialize(as = ImmutableFileListResponse.class)
@JsonDeserialize(as = ImmutableFileListResponse.class)
public interface FileListResponse {
@JsonProperty("FileStatuses")
JSONObject fileStatuses();
}
But it throws the following error: unrecognized field "FileStatus", not marked as ignorable (0 known properties )
But if I read the Json as String and then use JSONObject obj = new JSONObject(source);
It works perfectly.
Where am I going wrong?