KotlinxSerializationJsonSerializer
@ExperimentalSerializationApi
Content copied to clipboard
A JsonSerializer for integrating with kotlinx.serialization
.
CAVEAT: This class uses experimental Kotlin Serialization APIs, and only works with non-nullable types. We plan to lift these limitations after kotlinx.serialization issue 1348 is resolved.
In the meantime, if you prefer not to rely on experimental APIs, or if you must read or write a nullable type, we advise doing the serialization "manually" as shown in the following sample. Note that you can still make KotlinxSerializationJsonSerializer the default serializer, and override the serialization for nullable types as needed.