code: public void write(Object obj)
      {
          traceReferences(obj);
          objVisited.clear();
          try
          {
              writeImpl(obj, true);
          }
          catch (Exception e)
          {
              throw new JsonIoException("Error writing object to JSON:", e);
          }
          flush();
          objVisited.clear();
          objsReferenced.clear();
      }
docs: Write the passed in Java object in JSON format.
  @param obj Object any Java Object or JsonObject.