public static String escapeJSONString(final String unsafeStr) {
        final StringBuilder buf = new StringBuilder(unsafeStr.length() * 2);
        escapeJSONString(unsafeStr, buf);
        return buf.toString();
    }
public static String escapeJSONString ( final String unsafeStr ) { final StringBuilder buf = new StringBuilder ( unsafeStr . length ( ) * 2 ) ; escapeJSONString ( unsafeStr , buf ) ; return buf . toString ( ) ; }
Escape a string to be surrounded in double quotes in JSON.

@param unsafeStr
The string to escape.
@return The escaped string.