I have the following JSON string
{
"_embedded": {
"issues": [
{
"projectId": 1,
"description": "description",
"reason": "reason",
"consequence": "consequence",
"category": null,
"severity": "HIGH",
"priority": "HIGH",
"source": "INTERN",
"owner": "owner",
"deadline": 1234567890,
"cost": 0,
"status": "OPEN",
"versionNo": 0,
"creationTimestamp": 1419255929860,
"lastUpdateTimestamp": 1419255929860,
"createdBy": "",
"lastUpdatedBy": "",
"_links": {
"self": {
"href": "http://lcalhost:8080/im-access/api/issues/1"
}
}
},
{
"projectId": 1,
"description": "description",
"reason": "reason",
"consequence": "consequence",
"category": null,
"severity": "HIGH",
"priority": "HIGH",
"source": "INTERN",
"owner": "owner",
"deadline": 1234567890,
"cost": 0,
"status": "OPEN",
"versionNo": 0,
"creationTimestamp": 1418911336913,
"lastUpdateTimestamp": 1418911336913,
"createdBy": "",
"lastUpdatedBy": "",
"_links": {
"self": {
"href": "http://lcalhost:8080/im-access/api/issues/2"
}
}
},
{
"projectId": 1,
"description": "description",
"reason": "reason",
"consequence": "consequence",
"category": null,
"severity": "HIGH",
"priority": "HIGH",
"source": "INTERN",
"owner": "owner",
"deadline": 1234567890,
"cost": 0,
"status": "OPEN",
"versionNo": 0,
"creationTimestamp": 1418911337383,
"lastUpdateTimestamp": 1418911337383,
"createdBy": "",
"lastUpdatedBy": "",
"_links": {
"self": {
"href": "http://lcalhost:8080/im-access/api/issues/3"
}
}
}
]
}
}
When I try to fetch the data, using
ObjectMapper objectMapper = new ObjectMapper();
List<IssueDTO> asList = objectMapper.readValue(new URL("http://lcalhost:8080/imaccess/api/issues"), objectMapper.getTypeFactory().constructCollectionType(List.class, IssueDTO.class));
I get org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token.
I also tried to use RestTemplate and create a Wrapper class for the issues, but didn't have much luck with it either.