codecs.basic.CollectionJSONEncoderCodec.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
object CollectionJSONCodec : AbstractJSONCodec, JSONCodingContext>() {
@Suppress("UNCHECKED_CAST")
override fun JSONDecoder.decode(valueType: JSONCodingType>): Collection<*> =
ListJSONDecoderCodec.run { decode(valueType as JSONCodingType>) }
override fun JSONEncoder.encode(value: Collection<*>): Unit =
writeList(value)
val nonRecursive: JSONCodec, JSONCodingContext> = NonRecursiveJSONCodec.create()
}