Hi, I'm parsing this JSON string with the libs in org.json and I can't understand why I get the output below into the log.
ArrayList<String> al = new ArrayList<String>();
JSONObject demo = new JSONObject("{\"00408C88A2E6\":{\"id\":\"00408C88A2E6\",\"name\":\"Lab\"},\"00408C91188B\":{\"id\":\"00408C91188B\",\"name\":\"Lab1\"},\"00408C944B99\":{\"id\":\"00408C944B99\",\"name\":\"Lato1\"},\"00408C944BA0\":{\"id\":\"00408C944BA0\",\"name\":\"Lato\"}}");
Iterator<String> iterator = demo.keys();
while (iterator.hasNext() ){
al.add((String)iterator.next());
Log.i(LOG_TAG, "size al into while " + al.size());
Log.i(LOG_TAG, "MAC " + iterator.next() + " for the user " + userId);
}
Log output
07-12 08:55:34.056: INFO/parse(285): size al into while 1
07-12 08:55:34.056: INFO/parse(285): MAC 00408C91188B for the user nweb
07-12 08:55:34.066: INFO/parse(285): size al into while 2
07-12 08:55:34.066: INFO/parse(285): MAC 00408C944B99 for the user nweb
07-12 08:55:34.066: INFO/parse(285): size al 2
Should not have 4 elements in my ArrayList? Thank you