//Model class
class Model {
private String mId ;
private String mScore;
public Model (String id , String score){
mId = id ;
mScore= score
}
//getter and setter
}
//クラスで
private ArrayLsit getLsit(String str){
ArrayLsit<Model > list = new ArrayLsit<Model>();
// getting JSON string from URL
JSONObject json = new JSONObject(str);
try {
// Getting Array of Contacts
contacts = json.getJSONArray("data");
// looping through All Contacts
for(int i = 0; i < contacts.length(); i++){
JSONObject c = contacts.getJSONObject(i);
// Storing each json item in variable
String id = c.getString("id");
String score= c.getString("score");
list.add(new Model(id ,score))
}
} catch (JSONException e) {
e.printStackTrace();
}
return list
}