Well, I want to parse JSON code to my custom ArrayList which has title and description parameters.
[
{
"title" : "title1",
"description" : "desc1"
},
{
"title" : "title2",
"description" : "desc2"
}
]
Here is my code:
ArrayList<Model> arr = new ArrayList<>();
JSONArray ja = new JSONArray(new JSONObject(jsonString).getJSONArray(jsonString);
for(int i = 0; i < ja.length(); i++)
{
JSONObject jo = ja.getJSONObject(i);
String title = jo.getString("title");
String desc = jo.getString("description");
arr.add(new Model(title, desc));
}
but instead of getting the whole list, I get only first element... parsed values look like:
Title: title1
Desc: desc1
So, I cant read the whole array, help me.