I have json:
{
"id": 1,
"result": [
{
"id": 1,
"imgUrl": "http://test.com/image.jpg",
"title": "image"
},
{
"id": 2,
"imgUrl": "http://test.com/image2.jpg",
"title": "image2"
}
],
"jsonrpc": "2.0"
}
how i can parse internal array, i try default retroif gson parsing using model
public class TestRequest {
public int id;
public List<ArrayItems> result;
public String jsonrpc;
}
public class Item {
public int id;
public String imgUrl;
public String title;
}
and i have error: Expected BEGIN_OBJECT but was BEGIN_ARRAY. Then i try hand parse
Item[] items = GSON.fromJson(json, Item[].class);
and have error:
Expected BEGIN_ARRAY but was BEGIN_OBJECT.
What do we have to do?