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();
}
Mohamed Boumlyk