Dynamic Json Object Keyset Finding
import java.util.Iterator;
import java.util.Set;
import org.json.simple.JSONObject;
public class Json {
public static void main(String[] args) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("a", "aaa");
jsonObject.put("b", "bbb");
Set keys = jsonObject.keySet();
Iterator a = keys.iterator();
while(a.hasNext()) {
String key = (String)a.next();
// loop to get the dynamic key
String value = (String)jsonObject.get(key);
System.out.print("key : "+key);
System.out.println(" value :"+value);
}
}
}