I use a JSON library called JSONObject
(I don\'t mind switching if I need to).
I know how to iterate over JSONArrays
, but when I parse JSO
Can't believe that there is no more simple and secured solution than using an iterator in this answers...
JSONObject names ()
method returns a JSONArray
of the JSONObject
keys, so you can simply walk though it in loop:
JSONObject object = new JSONObject ();
JSONArray keys = object.names ();
for (int i = 0; i < keys.length (); i++) {
String key = keys.getString (i); // Here's your key
String value = object.getString (key); // Here's your value
}