code: public String write(Bean bean, boolean rootType) {
          StringBuilder buf = new StringBuilder(1024);
          try {
              write(bean, rootType, buf);
          } catch (IOException ex) {
              throw new IllegalStateException(ex);
          }
          return buf.toString();
      }
docs: Writes the bean to a string specifying whether to include the type at the root.
  
  @param bean  the bean to output, not null
  @param rootType  true to output the root type
  @return the JSON, not null