code: private void endJSON()
      throws SAXException
      {   
          if (logger.isLoggable(Level.FINER)) logger.entering(className, "endJSON()");
  
          try
          {
              this.head.writeObject(this.osWriter, 0, true, this.compact);
              this.head    = null;
              this.current = null;
              this.previousObjects.clear();
          }
          catch (Exception ex)
          {
              SAXException saxEx = new SAXException(ex);
              saxEx.initCause(ex);
              throw saxEx;
          }
  
          if (logger.isLoggable(Level.FINER)) logger.exiting(className, "endJSON()");
      }
docs: Internal method to end the JSON generation and to write out the resultant JSON text
  and reset the internal state of the hander.