I can't work out how to deserialize an array inside a JSON object using Gson. The json object that i'm trying to deserialize looks like this:
{"item0":3,
"item1":1,
"item2":3,
"array":[
{"arrayItem1":321779321,
"arrayItem2":"asdfafd",
"arrayItem3":"asasdfadf"}]}
I manage to build a class that looks like this:
public class Watchlist {
private int itemn0;
private int itemn1;
private int itemn2;
private Object array;
}
But when gson tries to deserialize the array it throws an exception:
com.google.gson.JsonParseException: Type information is unavailable, and the target object is not a primitive: <my gson array>
Can someone please tell me how to deserialize this?