title: Extracting all values from nested JSON
body: <p>I am fairly new to JSON parser and I am trying to extract all data set from "sizes" tag i.e extracting values (small, yes, xsmall, NO, Medium and yes) from the JSON file in a complex nested loop but doesn't work.  I am using GSON to parse the JSON file and using JAVA as programming language</p>
  
  <p>Here how the JSON file looks like in general</p>
  
  <pre><code>{ response: "ok",
    prodinfo: {
      sizes: [ 
        { size:"small", 
          available: "yes"
        }, 
        { size:"xsmall", 
          available: "No"
        },
        { size:"Medium", 
          available: "yes"
        }
      ]
    }
  }
  </code></pre>
  
  <p>This is what i did</p>
  
  <pre><code>int array = jsonParser14.parse(json14).getAsJsonObject().get("ProdInfo").getAsJsonObject().getAsJsonArray("sizes").size();
  JsonArray sizes = (JsonArray) jsonParser15.parse(json15).getAsJsonObject().get("ProdInfo").getAsJsonObject().getAsJsonArray("sizes");
  for (int i = 0; i &lt;= array; i++) {
      String size = sizes.get(i).getAsString();
      System.out.println("data extracted are: " + size);
  }
  </code></pre>
  
  <p>Your help will be appreciated.
  Thanks</p>