class ScriptUtils {

    public static String convertToJsValue(Map<String, String> stringMap) {
        if (stringMap == null || stringMap.isEmpty()) {
            return "{}";
        }

        String convertedValue = "{";
        for (String key : stringMap.keySet()) {
            convertedValue = convertedValue + "\"" + key + "\":" + convertToJsValue(stringMap.get(key)) + ",";
        }

        convertedValue = StringUtils.removeEnd(convertedValue, ",");
        convertedValue = convertedValue + "}";

        return convertedValue;
    }

}