All Downloads are FREE. Search and download functionalities are using the official Maven repository.

codecs.basic.AnyJSONDecoderCodec.kt Maven / Gradle / Ivy

There is a newer version: 0.9.24
Show newest version
package com.github.fluidsonic.fluid.json


object AnyJSONDecoderCodec : AbstractJSONDecoderCodec() {

	override fun JSONDecoder.decode(valueType: JSONCodingType): Any =
		when (nextToken) {
			JSONToken.booleanValue -> readValueOfType()
			JSONToken.listStart -> readValueOfType>()
			JSONToken.mapKey -> readValueOfType()
			JSONToken.mapStart -> readValueOfType>()
			JSONToken.numberValue -> readValueOfType()
			JSONToken.stringValue -> readValueOfType()
			else -> error("impossible token: $nextToken")
		}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy