kotlinx.serialization
kotlinx.serialization copied to clipboard
Kotlin multiplatform / multi-format serialization
Registering serializer module as contextual and passing a KSerializer that has nullable type is not allowed. It is needed due to bad backend responses when field value is not null,...
JSON deserialization is extremely slow, at least on JS target. I've written the same deserializer myself like this: ```kotlin override fun decode(string: String): List { val jsonArray = JSON.parse(string) return...
**Describe the bug** After upgrading to `1.4.0` I was seeing runtime crashes originating here https://github.com/Kotlin/kotlinx.serialization/blob/v1.4.0/core/commonMain/src/kotlinx/serialization/internal/Primitives.kt#L66 Amongst others we have a custom serializer for `DayOfWeek`: ``` @Serializer(forClass = DayOfWeek::class) public object...
**Describe the bug** It is impossible to use `kotlinx-serialization-hocon` without `kotlinx-serialization-core` added explicitly because `core` module is added with `implementation` configuration in `hocon` module: https://github.com/Kotlin/kotlinx.serialization/blob/d5bc32dc11d2a8a08c36663b93839d4fe91f4507/formats/hocon/build.gradle#L22 **To Reproduce** 1. Add `kotlinx-serialization-hocon`...
**Describe the bug** Errors occurred when trying to deserialize instances for parameterized abstract and sealed classes. **To Reproduce** ``` @Serializable sealed class TypedSealedClass(val a: T) { @Serializable data class Child(val...
In branch [`murmur_hash`](https://github.com/Kotlin/kotlinx.serialization/blob/a2277b377f2b57ffeb96da559222acb53d3918a4/runtime/jvm/src/test/kotlin/kotlinx/serialization/hashing/MurMurTest.kt#L17) I've introduced a prototype which leverages serialization infrastructure to implement Guava-like 128-bit MurMur3 hash. The main idea is to provide `KOutput` which hashes given object instead of...
#1987 Added method which allow to perform large string handling (decode base64 binary for example) at user level
**Describe the bug** ``` @Serializable @JvmInline value class Name(val v: String) ``` Encoding a value of that class to a JSON string works as expected, but `encodeToJsonElement` throws the exception...
JsonNamingStrategy.SnakeCase will replace normal uppercase characters with lowercase characters. For example: ```kotlin @Serializable data class ExperimentalOptions(@SerialName("QUIC") val quicItem: QuicItem) ``` "QUIC" after serialization becomes "quic".
The following types are given: ``` object PlainSerializer: ToDoSerializer("my-plain") object EnumSerializer: ToDoSerializer("my-enum") class Plain(val i: Int) enum class EnumType { A, B } ... abstract class ToDoSerializer(descriptorName: String): KSerializer {...