code: protected JsonWriter writeObject(Object object) throws IOException {
        if (object == null) {
           nullValue();
        } else if (object instanceof JsonSerializable) {
           JsonSerializable structuredSerializable = Cast.as(object);
           if (object instanceof JsonArraySerializable) {
              beginArray();
           } else {
              beginObject();
           }
           structuredSerializable.toJson(this);
           if (object instanceof JsonArraySerializable) {
              endArray();
           } else {
              endObject();
           }
        } else if (object instanceof Number) {
           value(Cast.<Number>as(object));
        } else if (object instanceof String) {
           value(Cast.<String>as(object));
        } else if (object instanceof Boolean) {
           value(Cast.<Boolean>as(object).toString());
        } else if (object instanceof Enum) {
           value(Cast.<Enum>as(object).name());
        } else if (object instanceof EnumValue) {
           value(Cast.<EnumValue>as(object).name());
        } else if (object instanceof Map) {
           value(Cast.<Map<String, ?>>as(object));
        } else if (object.getClass().isArray()) {
           value(Cast.<Object[]>as(object));
        } else if (object instanceof Multimap) {
           value(Cast.<Multimap<String, ?>>as(object).asMap());
        } else if (object instanceof Counter) {
           value(Cast.<Counter<String>>as(object).asMap());
        } else if (object instanceof Iterable) {
           value(Cast.<Iterable>as(object));
        } else if (object instanceof Iterator) {
           value(Cast.<Iterator>as(object));
        } else {
           value(Convert.convert(object, String.class));
        }
        return this;
     }
docs: Serializes an object
  
  @param object the object to serialize
  @return This structured writer
  @throws IOException Something went wrong writing