I receive this JSON string:
{
"response": [
346,
{
"id": 564,
"from_id": -34454802,
"to_id": -34454802,
"date": 1337658196,
"post_type": "post"
},
{
"id": 2183,
"from_id": -34454802,
"to_id": -34454802,
"date": 1423916628,
"post_type": "post"
},
{
"id": 2181,
"from_id": -34454802,
"to_id": -34454802,
"date": 1423724270,
"post_type": "post"
}]
}
I create following classes:
public class Response {
@SerializedName("response")
ArrayList<Post> posts;
}
public class Post {
int id;
int from_id;
int to_id;
long date;
String post_type;
}
When I try parse response, I get error:
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was NUMBER at line 1 column 19 path $.response[0]
This because first element of array is Number. Which model is required to operate without error?