1JSONArray data = new JSONArray(); //create data from this -> [{"thumb_url":"tb-1370913834.jpg","event_id":...}]
2
3List<JSONObject> list = data.stream().map(o -> (JSONObject) o).collect(Collectors.toList());
4
1List<Employee> list = mapper.readValue(jsonString,
2TypeFactory.defaultInstance().constructCollectionType(List.class,
3 Employee.class));
4
1// Top of file
2import java.lang.reflect.Type;
3
4// ...
5
6private void parseJSON() {
7 Gson gson = new Gson();
8 Type type = new TypeToken<List<ContactModel>>(){}.getType();
9 List<ContactModel> contactList = gson.fromJson(jsonString, type);
10 for (ContactModel contact : contactList){
11 Log.i("Contact Details", contact.id + "-" + contact.name + "-" + contact.email);
12 }
13}