I am trying to extract the value from a key-value pair in a JSONObect. Here is the structure:
{"key1 ":["dog","cat"],"key2":["house","boat"]}
So, I want to extract the values dog and cat, also values house and boat. I tried the following in Java:
    //obj - has this JSON.
    Iterator iter = obj.keys();
    for (int i=0; i<len; i++){
        String key = (String)iter.next();
        System.out.println("Key is --> "+key);  //This is correctly giving me the keys.
        System.out.println("Value is --> "+clientDetails.getJSONArray(key)); //This is not working. I tried lots of other things but to no avail.
     }
Could somebody please guide me here.
thanks, Kay
 
     
     
     
    