@Test public void testFromMap() throws Exception { Map<String, String> map = new HashMap<String, String>(); JSONObject json; map.put("key", "value"); map.put("key with spaces", "value"); json = JSONUtils.fromMap(map); assertEquals("value", json.getString("key")); assertEquals("value", json.getString("key with spaces")); }
public static JSONObject fromMap(Map<String, String> map) throws JSONException { JSONObject json = new JSONObject(); if (map == null) return json; for (Entry<String, String> entry : map.entrySet()) { json.put(entry.getKey(), entry.getValue()); } return json; }
JSONUtils { public static JSONObject fromMap(Map<String, String> map) throws JSONException { JSONObject json = new JSONObject(); if (map == null) return json; for (Entry<String, String> entry : map.entrySet()) { json.put(entry.getKey(), entry.getValue()); } return json; } }
JSONUtils { public static JSONObject fromMap(Map<String, String> map) throws JSONException { JSONObject json = new JSONObject(); if (map == null) return json; for (Entry<String, String> entry : map.entrySet()) { json.put(entry.getKey(), entry.getValue()); } return json; } private  JSONUtils(); }
JSONUtils { public static JSONObject fromMap(Map<String, String> map) throws JSONException { JSONObject json = new JSONObject(); if (map == null) return json; for (Entry<String, String> entry : map.entrySet()) { json.put(entry.getKey(), entry.getValue()); } return json; } private  JSONUtils(); static JObject mapToJSON(Map<String, String> map); static JValue setToJSON(Set<String> set); static JValue filtersToJSON(ResourceListQuery query, ListProvidersService listProvidersService,
          Organization org); static JValue filtersToJSONSeriesWriteAccess(ResourceListQuery query, ListProvidersService listProvidersService,
          Organization org, Map<String, String> series); static JSONObject fromMap(Map<String, String> map); static Map<String, String> toMap(JSONObject json); }
JSONUtils { public static JSONObject fromMap(Map<String, String> map) throws JSONException { JSONObject json = new JSONObject(); if (map == null) return json; for (Entry<String, String> entry : map.entrySet()) { json.put(entry.getKey(), entry.getValue()); } return json; } private  JSONUtils(); static JObject mapToJSON(Map<String, String> map); static JValue setToJSON(Set<String> set); static JValue filtersToJSON(ResourceListQuery query, ListProvidersService listProvidersService,
          Organization org); static JValue filtersToJSONSeriesWriteAccess(ResourceListQuery query, ListProvidersService listProvidersService,
          Organization org, Map<String, String> series); static JSONObject fromMap(Map<String, String> map); static Map<String, String> toMap(JSONObject json);  }