My question is this: How can I convert the result
object to a list (array) in Java ?.
The JSON is something like the following:
{
"order_id": "12345",
"paging": {
"total": 41,
"offset": 0,
"limit": 50
},
"results": [{
"id": "1",
"title": "Item Title1",
"price": 330,
"available_quantity": 1,
"sold_quantity": 0
},
{
"id": "2",
"title": "Item Title 2",
"price": 310,
"available_quantity": 1,
"sold_quantity": 0
}
]
}
So far I tried to analyze it with the class Search
(which contains a list of elements with the same attributes as those of the JSON ):
arrayreq = gson.fromJson(response.getResponseBody(), Search.class);
And also try this:
arrayreq = gson.fromJson(response.getResponseBody(), String[].class);
I have 2 similar actions running but none of the JSON that parsean has lists.
My class Search.java
:
public class Search {
private String order_id;
private Paging paging;
private List<Item> results;//No se si esta bien