code: public final void toJson(Writer out, T value) throws IOException {
      JsonWriter writer = new JsonWriter(out);
      write(writer, value);
    }
docs: Converts {@code value} to a JSON document and writes it to {@code out}.
  Unlike Gson's similar {@link Gson#toJson(JsonElement, Appendable) toJson}
  method, this write is strict. Create a {@link
  JsonWriter#setLenient(boolean) lenient} {@code JsonWriter} and call
  {@link #write(com.google.gson.stream.JsonWriter, Object)} for lenient
  writing.
  
  @param value the Java object to convert. May be null.
  @since 2.2