I have a very simple JSON with reviews for products, like:
{
\"reviewerID\": \"A2XVJBSRI3SWDI\",
\"asin\": \"0000031887\",
\"reviewerName\": \"abigai
You have to fetch the whole data in the list and then do the iteration as it is a file and will become inefficient otherwise.
private static final Type REVIEW_TYPE = new TypeToken>() {
}.getType();
Gson gson = new Gson();
JsonReader reader = new JsonReader(new FileReader(filename));
List data = gson.fromJson(reader, REVIEW_TYPE); // contains the whole reviews list
data.toScreen(); // prints to screen some values