toJson

open override fun toJson(writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, value: List<T>)

Serializes a Kotlin type into its equivalent Json representation.

Example:

override fun toJson(writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, value: LocalDateTime) {
writer.value(value.toString())
}

Alternatively, you can use the built-in AnyAdapter:

override fun toJson(writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, value: GeoPoint) {
val map = mapOf("lat" to value.lat, "lon" to value.lon)
AnyAdapter.toJson(writer, map)
}