code: public void serialize(Writer writer, boolean verbose) throws IOException {
          Serializer serializer;
  
          //Try to avoid double-buffering or buffering in-memory
          //writers.
          Class writerClass = writer.getClass();
          if (!StringWriter.class.isAssignableFrom(writerClass) &&
              !CharArrayWriter.class.isAssignableFrom(writerClass) &&
              !BufferedWriter.class.isAssignableFrom(writerClass)) {
              writer = new BufferedWriter(writer);
          }
  
          if (verbose)
          {
              serializer = new SerializerVerbose(writer);
          }
          else
          {
              serializer = new Serializer(writer);
          }
          serializer.writeObject(this).flush();
      }
docs: Convert this object into a stream of JSON text, specifying verbosity.
  @param writer The writer which to serialize the JSON text to.
  
  @throws IOException Thrown on IO errors during serialization.