code: public void writeObject(Writer writer, int indentDepth, boolean contentOnly, boolean compact)
      throws IOException
      {
          if (logger.isLoggable(Level.FINER)) logger.entering(className, "writeObject(Writer, int, boolean, boolean)");
  
          if (writer != null)
          {
              try
              {
                  if (isEmptyObject())
                  {
                      writeEmptyObject(writer,indentDepth,contentOnly, compact);
                  }
                  else if (isTextOnlyObject())
                  {
                      writeTextOnlyObject(writer,indentDepth,contentOnly, compact);  
                  }
                  else
                  {
                      writeComplexObject(writer,indentDepth,contentOnly,compact);
                  }
  
              }
              catch (Exception ex)
              {
                  IOException iox = new IOException("Error occurred on serialization of JSON text.");
                  iox.initCause(ex);
                  throw iox;
              }
          }
          else
          {
              throw new IOException("The writer cannot be null.");
          }
  
          if (logger.isLoggable(Level.FINER)) logger.entering(className, "writeObject(Writer, int, boolean, boolean)");
      }
docs: Method to write out the JSON formatted object.
  @param writer The writer to use when serializing the JSON structure.
  @param indentDepth How far to indent the text for object's JSON format.
  @param contentOnly Flag to debnnote whether to assign this as an attribute name, or as a nameless object.  Commonly used for serializing an array.  The Array itself has the name,   The contents are all nameless objects
  @param compact Flag to denote to write the JSON in compact form.  No indentions or newlines.  Setting this value to true will cause indentDepth to be ignored.
  @throws IOException Trhown if an error occurs on write.