code: public void toJson(Object src, Appendable writer) throws JsonIOException {
      if (src != null) {
        toJson(src, src.getClass(), writer);
      } else {
        toJson(JsonNull.INSTANCE, writer);
      }
    }
docs: This method serializes the specified object into its equivalent Json representation.
  This method should be used when the specified object is not a generic type. This method uses
  {@link Class#getClass()} to get the type for the specified object, but the
  {@code getClass()} loses the generic type information because of the Type Erasure feature
  of Java. Note that this method works fine if the any of the object fields are of generic type,
  just the object itself should not be of a generic type. If the object is of generic type, use
  {@link #toJson(Object, Type, Appendable)} instead.
  
  @param src the object for which Json representation is to be created setting for Gson
  @param writer Writer to which the Json representation needs to be written
  @throws JsonIOException if there was a problem writing to the writer
  @since 1.2