codecs.basic.NonRecursiveJSONEncoderCodec.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
import kotlin.reflect.KClass
internal class NonRecursiveJSONEncoderCodec(
override val encodableClass: KClass
) : JSONEncoderCodec {
override fun JSONEncoder.encode(value: Value) {
JSONSerializer.default.serializeValue(value, destination = this, withTermination = false)
}
companion object {
inline fun create(): JSONEncoderCodec =
NonRecursiveJSONEncoderCodec(encodableClass = Value::class)
}
}