code: public void toJson(Object src, Type typeOfSrc, Appendable writer) throws JsonIOException {
      try {
        JsonWriter jsonWriter = newJsonWriter(Streams.writerForAppendable(writer));
        toJson(src, typeOfSrc, jsonWriter);
      } catch (IOException e) {
        throw new JsonIOException(e);
      }
    }
docs: This method serializes the specified object, including those of generic types, into its
  equivalent Json representation. This method must be used if the specified object is a generic
  type. For non-generic objects, use {@link #toJson(Object, Appendable)} instead.
  
  @param src the object for which JSON representation is to be created
  @param typeOfSrc The specific genericized type of src. You can obtain
  this type by using the {@link com.google.gson.reflect.TypeToken} class. For example,
  to get the type for {@code Collection<Foo>}, you should use:
  <pre>
  Type typeOfSrc = new TypeToken&lt;Collection&lt;Foo&gt;&gt;(){}.getType();
  </pre>
  @param writer Writer to which the Json representation of src needs to be written.
  @throws JsonIOException if there was a problem writing to the writer
  @since 1.2