Quantcast
Channel: Loop through nested JSON array - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by lewis machilika for Loop through nested JSON array

$
0
0

You may try

        public void printJsonObject(JSONObject jsonObj) {            for (String keyStr : jsonObj.keySet()) {                Object keyvalue = jsonObj.get(keyStr);                //Print key and value                System.out.println("key: "+ keyStr +" value: " + keyvalue);                //for nested objects iteration if required                if (keyvalue instanceof JSONObject)                    printJsonObject((JSONObject)keyvalue);            }        }

Viewing all articles
Browse latest Browse all 3

Trending Articles