package xyz.fycz.myreader.util; import com.google.gson.Gson; import org.json.JSONArray; import java.util.ArrayList; public class JsonArrayToObjectArray { public static ArrayList getArray(String json, Class c) throws Exception { ArrayList arrayList = new ArrayList<>(); JSONArray jsonArray = new JSONArray(json); for (int i = 0; i < jsonArray.length(); i++) { arrayList.add(new Gson().fromJson(jsonArray.getString(i), c)); } return arrayList; } }