I'm new to Java and I have a problem :
JSONObject data = new JSONObject(json);
List<String> list = (List<String>) data.getJSONArray("childrens");
for (String item : list) {
Log.d("DEBUG", item);
}
I would like to assign data.getJSONArray("childrens")
to a variable list
, but I have an error:
java.lang.ClassCastException: org.json.JSONArray cannot be cast to java.util.List
How can I do this?
I would like to iterate over JSON Array.