kotlinx-serialization / kotlinx.serialization.json / Json / fromJson

fromJson

(common, js, jvm, native) fun <T> fromJson(deserializer: DeserializationStrategy<T>, json: JsonElement): T

Deserializes json element into a corresponding object of type T using provided deserializer.

Exceptions

JsonException - in case of malformed json

SerializationException - if given input can not be deserialized

(common, js, jvm, native) fun <reified T : Any> fromJson(tree: JsonElement): T

Deserializes json element into a corresponding object of type T using serializer registered in the module.

Exceptions

JsonException - in case of malformed json

SerializationException - if given input can not be deserialized