I have a class called
class Student {
String name;
String age;
}
I have a method that returns List object like
publi
Using Gson Library it will be very simple.
From JSON String to ArrayList of Object as:
Type listType =
new TypeToken>(){}.getType();
ArrayList yourClassList = new Gson().fromJson(jsonArray, listType);
And to Json from Array List of Object as:
ArrayList sampleList = new ArrayList();
String json = new Gson().toJson(sampleList);
The Gson Library is more simple to use than JSONObject and JSONArray implementation.