List of utility methods to do Map to Json
String | mapToJson(Map map To Json final StringBuilder sb = new StringBuilder("{"); Iterator<Map.Entry<String, Object>> itr = map.entrySet().iterator(); while (itr.hasNext()) { Map.Entry<String, Object> e = itr.next(); sb.append('"').append(e.getKey()).append("\":\"").append(e.getValue().toString()).append('"'); if (itr.hasNext()) sb.append(", "); return sb.append('}').toString(); |
String | mapToJson(Map map To Json StringBuilder builder = new StringBuilder(1024); builder.append(pretty ? indent + "{\n" : "{"); int count = 0; for (Entry<String, Object> entry : map.entrySet()) { final String key = entry.getKey(); final Object val = entry.getValue(); if (count > 0) { builder.append(pretty ? ",\n" : ","); ... |
String | mapToJson(Map map To Json return null;
|
String | mapToJson(Map map To Json StringBuffer json = new StringBuffer("{"); int index = 0; for (String key : map.keySet()) { if (index > 0) { json.append(","); json.append("'" + key + "':'" + map.get(key) + "'"); index++; ... |
String | toJson(Map join map if (map == null || map.size() == 0) { return null; StringBuilder paras = new StringBuilder(); paras.append("{"); Iterator<Map.Entry<String, String>> ite = map.entrySet().iterator(); while (ite.hasNext()) { Map.Entry<String, String> entry = (Map.Entry<String, String>) ite.next(); ... |
String | toJSON(Map to JSON if (map == null) return null; else if (map.size() == 0) return "{}"; StringBuilder jsonBuilder = new StringBuilder(map.containsKey("") ? map.get("") : ""); jsonBuilder.append(JSON_OBJECT_START); for (Map.Entry<String, String> entry : map.entrySet()) { String key = entry.getKey(); ... |
String | toJSON(Map to JSON StringBuilder builder = new StringBuilder(); builder.append('{'); boolean first = true; for (Map.Entry<String, String> entry : map.entrySet()) { if (first) first = false; else builder.append(','); ... |
String | toJSON(Map Builds a JSON string form the given map StringBuffer sb = new StringBuffer("{"); for (String key : map.keySet()) { String optionValue = map.get(key); if (sb.length() > 1) { sb.append(","); sb.append("\"" + key + "\""); sb.append(":"); ... |
String | toJSONString(Map Convert a map to JSON text. int subIndentLevel = indentLevel + 1; if (map == null) return getIndent(indentLevel) + "null"; StringBuffer sb = new StringBuffer(); boolean first = true; Iterator<T> iter = map.keySet().iterator(); sb.append('{'); sb.append("\n"); ... |