code: public static String mapAsJson(Map<String, String> map) {
  
          JSONObject obj = new JSONObject();
          for (Map.Entry<String, String> entry : map.entrySet()) {
              try {
                  obj.put(entry.getKey(), entry.getValue());
              } catch (JSONException e) {
                  LOG.error(e.getLocalizedMessage(), e);
              }
          }
          return obj.toString();
      }
docs: Encodes a map with string keys and values as a JSON string with the same keys/values.<p>
  
  @param map the input map
  @return the JSON data containing the map entries