Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to iterate over JSONObject

JSONObject jsonObject = new JSONObject(contents.trim());
Iterator<String> keys = jsonObject.keys();

while(keys.hasNext()) {
    String key = keys.next();
    if (jsonObject.get(key) instanceof JSONObject) {
          // do something with jsonObject here      
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #iterate #JSONObject
ADD COMMENT
Topic
Name
4+8 =