So I'm trying to get all the keys within a specific JSON Object but only the last key is obtained.
public void setUpSearch(JSONObject data_json){
Iterator<String> keys = data_json.keys();
while (keys.hasNext()) {
//get the key
String key = keys.next();
scripts = new ArrayList<String>();
scripts.add(key);
Log.i(TAG, key);
Log.i(TAG, String.valueOf(scripts));
}
Logtagging key shows all keys (around 300 of em), however logtagging scripts shows only the last one.
Any help will be highly appreciated.