### Question:
ELConstantsFunctions { public static String toJsonStr(Map<String, String> map) { String json = JSONValue.toJSONString(map); return XmlUtils.escapeCharsForXML(json); }  static Object firstNotNull(Object o1, Object o2); static String concat(String s1, String s2); static String replaceAll(String src, String regex, String replacement); static String appendAll(String src, String append, String delimeter); static String trim(String input); static String timestamp(); static String urlEncode(String input); static String toJsonStr(Map<String, String> map); static String toPropertiesStr(Map<String, String> map); static String toConfigurationStr(Map<String, String> map); static final long KB; static final long MB; static final long GB; static final long TB; static final long PB; static final int SUBMIT_MINUTES; static final int SUBMIT_HOURS; static final int SUBMIT_DAYS; }### Answer:
@Test public void testToJsonStr() throws Exception { Map<String, String> map = new HashMap<String, String>(); map.put("a", "A"); map.put("b", "&"); String str = ELConstantsFunctions.toJsonStr(map); Element e = XmlUtils.parseXml("<x>" + str + "</x>"); JSONObject json = (JSONObject) new JSONParser().parse(e.getText()); Map<String, String> map2 = new HashMap<String, String>(json); assertEquals(map, map2); }