Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

mapToJsonString


    public static String mapToJsonString(Map<String, String> map) {
        if (map == null) {
            return JsonUtils.EMPTY_JSON;
        }
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        boolean z = true;
        for (Map.Entry next : map.entrySet()) {
            if (!z) {
                sb.append(",");
            }
            sb.append(""");
            sb.append((String) next.getKey());
            sb.append("":"");
            sb.append((String) next.getValue());
            sb.append(""");
            z = false;
        }
        sb.append("}");
        return sb.toString();
    }
 
PREVIOUS NEXT
Tagged: #mapToJsonString
ADD COMMENT
Topic
Name
9+6 =