class JSONUtil {

    private static String escapeBadIdentifierCodePoints( String propertyName, JSONConfig cfg )
    {
        boolean useSingleLetterEscapes = cfg.isFullJSONIdentifierCodePoints();
        boolean processInlineEscapes = true;

        StringProcessor cp = new StringProcessor(propertyName, cfg, useSingleLetterEscapes, processInlineEscapes);
        if ( cp.isNoProcessing() && isValidJavascriptPropertyNameImpl(propertyName, cfg) ){
            return propertyName;
        }
        StringBuilder buf = new StringBuilder(propertyName.length()+20);
        while ( cp.nextReady() ){
            String esc = cp.getEscape();
            if ( esc != null ){
                buf.append(esc);                        // have valid escape
            }else if ( cp.getIndex() > 0 && isValidIdentifierPart(cp.getCodePoint(), cfg) ){
                cp.appendChars(buf);
            }else if ( cp.getIndex() == 0 && isValidIdentifierStart(cp.getCodePoint(), cfg) ){
                cp.appendChars(buf);
            }else{
                buf.append(cp.getEscapeString());       // Bad code point for an identifier.
            }
        }

        return buf.toString();
    }

    private  JSONUtil();

}