Skip to content

Instantly share code, notes, and snippets.

View Rubatharisan's full-sized avatar

Rubatharisan Thirumathyam Rubatharisan

View GitHub Profile
public class Items {
private int id;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
JsonParserDemo jsonParserDemo =
new JsonParserDemo("/Users/rubas/item.json", true);
try(JsonReader jsonReader = jsonParserDemo.getJsonReader()){
Gson myGson = new Gson();
JsonParser jsonParser = new JsonParser();
JsonArray userArray = jsonParser.parse(jsonReader).getAsJsonArray();
ArrayList<Object> Items = new ArrayList<>();
for ( JsonElement aUser : userArray ){
Items aItem = myGson.fromJson(aUser, Items.class);