kotlinx.serialization v1.2.0 Release NotesRelease Date: 2021-04-27 // 3 months ago
🚑 This release has some known critical bugs, so we advise to use 1.2.1 instead.
🚀 This release contains a lot of new features and important improvements listed below; 0️⃣ Kotlin 1.5.0 is used as a default compiler and language version.
🐎 JSON performance improvements
JSON encoder and decoder were revisited and significantly rewritten, which lead us to up to 2-3x times speedup in certain cases. ➕ Additional details can be found in the corresponding issues: , .
Ability to specify alternative names during JSON decoding
🛠 The one of the most voted issues is fixed now — it is possible to specify multiple names for one property using new
@SerialName, it only affects JSON decoding, so it is useful when dealing with different versions of the API. 📚 We've prepared a documentation for you about it.
JsonConfiguration in public API
Generator for .proto files based on serializable Kotlin classes
Our implementation of Protocol Buffers format uses
@SerializableKotlin classes as a source of schema. This is very convenient for Kotlin-to-Kotlin communication, but makes interoperability between languages complicated. To resolve this issue, we now have a schema generator that can produce .proto files out of Kotlin classes. Using it, you can keep Kotlin classes as a source of truth and use traditional protoc compilers for other languages at the same time. 📚 To learn more, check out the documentation for the new
ProtoBufSchemaGeneratorclass or visit the corresponding PR.
Note: this generator is on its experimental stage and any feedback is very welcomed.
Contextual serialization of generic classes
Before 1.2.0, it was impossible to register context serializer for generic class, because
contextualfunction accepted a single serializer. Now it is possible to register a provider — lambda that allows to construct a serializer for generic class 📚 out of its type arguments serializers. See the details in the documentation.
- Support for watchosX64 target (#1366).
- Introduce kotlinx-serialization-bom (#1356).
- Support serializer on JS IR when T is an interface (#1431).