Esempio n. 1
0
 public static Map<String, Object> toMap(JSONObject jo) {
   HashMap<String, Object> m = new HashMap<String, Object>();
   if (jo != null) {
     JSONArray names = jo.names();
     if (names != null) {
       for (int i = 0; i < names.length(); i++) {
         String name = names.optString(i);
         Object o = jo.opt(name);
         if (o instanceof JSONObject) {
           m.put(name, toMap((JSONObject) o));
         } else if (o instanceof JSONArray) {
           m.put(name, FJA2List.toList((JSONArray) o));
         } else {
           m.put(name, o);
         }
       }
     }
   }
   return m;
 }