I'm here asking for your help after one week of headache :S
I need to deserialize this JSON Output using Jackson
{
"data": [
{
"id": "142065955831788",
"name": "Name1",
"link": "http://www.somelink.com",
},
{
"id": "160212467350470",
"name": "Name2",
"link": "http://www.somelink2.com",
}
.
.
.
}
I swear i've tried anything but I just can't make jackson deserialize that JSON.
What am I missing?
EDIT:
I've created a class like this:
Data.class
@JsonIgnoreProperties(ignoreUnknown = true)
public class Data{
@JsonProperty("data")
private String name;
@JsonProperty("data")
private String link;
//Getters + Setters
And this is my code for the mapping
ObjectMapper mObjectMapper = new ObjectMapper();
ArrayList<Data> mDataList;
mDataList = mObjectMapper.readValue(
url, /* The url returning the JSON */
mObjectMapper.getTypeFactory().constructCollectionType(
ArrayList.class, Data.class
)
);
And i get this error message:
Can not deserialize instance of java.util.ArrayList out of START_OBJECT token
"data": [in your json ?