toJson

abstract fun toJson(writer: JsonWriter, @Nullable value: T)

Encodes the given value with the given writer.

fun toJson(sink: BufferedSink, @Nullable value: T)
fun toJson(@Nullable value: T): String

Encodes the given value into a String and returns it.