@Test public void testJSONObject2Map() { logger.info("JSONObject2Map"); HashMap<String, Object> m = new HashMap(); m.put("one", "1"); m.put("two", 2); JSONObject jo = new JSONObject(m); Map<String, Object> result = Utils.JSONObject2Map(jo); assertEquals(m, result); }
public static Map<String, Object> JSONObject2Map(JSONObject jo) { Map<String, Object> map = new HashMap<String, Object>(); Iterator it = jo.keys(); while (it.hasNext()) { String key = (String) it.next(); Object o = jo.get(key); if (o instanceof JSONObject) { map.put(key, JSONObject2Map((JSONObject) o)); } else { map.put(key, o); } } return map; }
Utils { public static Map<String, Object> JSONObject2Map(JSONObject jo) { Map<String, Object> map = new HashMap<String, Object>(); Iterator it = jo.keys(); while (it.hasNext()) { String key = (String) it.next(); Object o = jo.get(key); if (o instanceof JSONObject) { map.put(key, JSONObject2Map((JSONObject) o)); } else { map.put(key, o); } } return map; } }
Utils { public static Map<String, Object> JSONObject2Map(JSONObject jo) { Map<String, Object> map = new HashMap<String, Object>(); Iterator it = jo.keys(); while (it.hasNext()) { String key = (String) it.next(); Object o = jo.get(key); if (o instanceof JSONObject) { map.put(key, JSONObject2Map((JSONObject) o)); } else { map.put(key, o); } } return map; }  }
Utils { public static Map<String, Object> JSONObject2Map(JSONObject jo) { Map<String, Object> map = new HashMap<String, Object>(); Iterator it = jo.keys(); while (it.hasNext()) { String key = (String) it.next(); Object o = jo.get(key); if (o instanceof JSONObject) { map.put(key, JSONObject2Map((JSONObject) o)); } else { map.put(key, o); } } return map; }  static synchronized EPServiceProvider initEPService(ServletContext sc); static synchronized void destroyEPService(ServletContext sc); static Map<String, Object> JSONObject2Map(JSONObject jo); static JSONObject Event2JSONObject(EventBean event); static JSONObject Statement2JSONObject(EPStatement st); static boolean DoHTTPPost(String urlStr, String content); static void putCorrelatorAndTrans(HttpServletRequest req); static String getBodyAsString(HttpServletRequest request); static void setTimerRuleHeaders(JSONObject rule); static Boolean isValidURL(String url); }
Utils { public static Map<String, Object> JSONObject2Map(JSONObject jo) { Map<String, Object> map = new HashMap<String, Object>(); Iterator it = jo.keys(); while (it.hasNext()) { String key = (String) it.next(); Object o = jo.get(key); if (o instanceof JSONObject) { map.put(key, JSONObject2Map((JSONObject) o)); } else { map.put(key, o); } } return map; }  static synchronized EPServiceProvider initEPService(ServletContext sc); static synchronized void destroyEPService(ServletContext sc); static Map<String, Object> JSONObject2Map(JSONObject jo); static JSONObject Event2JSONObject(EventBean event); static JSONObject Statement2JSONObject(EPStatement st); static boolean DoHTTPPost(String urlStr, String content); static void putCorrelatorAndTrans(HttpServletRequest req); static String getBodyAsString(HttpServletRequest request); static void setTimerRuleHeaders(JSONObject rule); static Boolean isValidURL(String url);  }