manisha
10/22/2018 - 8:26 PM

gson

String json = getAPIData(strings[0]);
JSONObject root = new JSONObject(json);
JSONArray JSONthreads = root.getJSONArray("threads");
List<threads> threadList = new ArrayList<>();

Gson gson = new Gson();
Type threadListType = new TypeToken<List<threads>>(){}.getType();
threadList=gson.fromJson(JSONthreads.toString(), threadListType);

//The attributes in thread class should have the same names as the keys in Json.