This release contains all features and bugfixes from 1.4.0-RC plus some bugfixes on its own (see below).
Kotlin 1.7.10 is used as a default.
- Fixed decoding of huge JSON data for okio streams (#2006)
This is a candidate for the next big release with many new exciting features to try.
It uses Kotlin 1.7.10 by default.
Integration with Okio's BufferedSource and BufferedSink
Okio library by Square is a popular solution for fast and efficient IO operations on JVM, K/N and K/JS.
In this version, we have added functions that parse/write JSON directly to Okio's input/output classes, saving you the overhead of copying data to
These functions are called
decodeBufferedSourceToSequence that behaves similarly to
decodeToSequence from Java streams integration, so you can lazily decode multiple objects the same way as before.
Note that these functions are located in a separate new artifact, so users who don't need them wouldn't find themselves dependent on Okio.
To include this artifact in your project, use the same group id
org.jetbrains.kotlinx and artifact id
To find out more about this integration, check new functions' documentation and corresponding pull requests:
#1901 and #1982.
Inline classes and unsigned numbers do not require experimental annotations anymore
Inline classes and unsigned number types have been promoted to a Stable feature in Kotlin 1.5,
and now we are promoting support for them in kotlinx.serialization to Stable status, too.
To be precise, we've removed all
@ExperimentalSerializationApi annotations from functions related to inline classes encoding and decoding,
Encoder.encodeInline, and some others. We've also updated related documentation article.
@ExperimentalUnsignedTypes annotations were removed completely,
so you can freely use types such as
UInt and their respective serializers as a stable feature
without opt-in requirement.
Part of SerializationException's hierarchy is public now
When kotlinx.serialization 1.0 was released, all subclasses of
SerializationException were made internal,
since they didn't provide helpful information besides the standard message.
Since then, we've received a lot of feature requests with compelling use-cases for exposing some of these internal types to the public.
In this release, we are starting to fulfilling these requests by making
One can use it in the
catch clause to better understand the reasons of failure — for example, to return 400 instead of 500 from an HTTP server — and then use its
fields property to communicate the message better.
See the details in the corresponding PR.
In future releases, we'll continue work in this direction, and we aim to provide more useful public exception types & properties.
In the meantime, we've revamped KDoc for some methods regarding the exceptions — all of them now properly declare which exception types are allowed to be thrown.
KSerializer.deserialize is documented to throw
IllegalStateException to indicate problems unrelated to serialization, such as data validation in classes' constructors.
This release introduces a new
@MetaSerializable annotation that adds
@Serializable behavior to user-defined annotations — i.e., those annotations would also instruct the compiler plugin to generate a serializer for class. In addition, all annotations marked with
@MetaSerializable are saved in the generated