code: public void setJavaScriptEscapeChars(final int[] escapeCharacters) {
  
          final CharacterEscapes ce = new CharacterEscapes() {
  
              private static final long serialVersionUID = 1L;
  
              @Override
              public int[] getEscapeCodesForAscii() {
                  if (escapeCharacters == null) {
                      return CharacterEscapes.standardAsciiEscapesForJSON();
                  }
                  return escapeCharacters;
              }
  
              @Override
              public SerializableString getEscapeSequence(final int ch) {
                  final String jsEscaped = escapeChar((char) ch);
                  return new SerializedString(jsEscaped);
              }
  
          };
  
          jsonGenerator.setCharacterEscapes(ce);
      }
docs: By default JSON output does only have escaping where it is strictly
  necessary. This is recommended in the most cases. Nevertheless it can
  be sometimes useful to have some more escaping.
  
  @param escapeCharacters an array which defines which characters should be
  escaped and how it will be done. See
  {@link CharacterEscapes}. In most cases this should
  be null. Use like this:
  <pre>{@code int[] esc = CharacterEscapes.standardAsciiEscapesForJSON();
  // and force escaping of a few others:
  esc['\''] = CharacterEscapes.ESCAPE_STANDARD;
  JsonEncoder.useEscapeJavaScript(esc);
  }</pre>