implementations.StandardCodingSerializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fluid-json-coding Show documentation
Show all versions of fluid-json-coding Show documentation
A JSON library written in pure Kotlin (coding extension)
package com.github.fluidsonic.fluid.json
internal class StandardCodingSerializer(
private val context: Context,
private val encoderFactory: (destination: JSONWriter, context: Context) -> JSONEncoder
) : JSONCodingSerializer {
override fun serializeValue(value: Any?, destination: JSONWriter, withTermination: Boolean) {
encoderFactory(destination, context)
.withTermination(withTermination) { writeValueOrNull(value) }
}
}