kotlinx.serialization v1.0.0-RC2 Release Notes
Release Date: 2020-09-21 // over 3 years ago-
๐ Second release candidate for 1.0.0 version. This RC contains tweaks and changes based on users feedback after 1.0.0-RC.
Major changes
JSON format is now located in different artifact (#994)
In 1.0.0-RC, the
kotlinx-serialization-core
artifact contained core serialization entities as well asJson
serial format.
We've decided to change that and to makecore
format-agnostic.
It would make the life easier for those who use other serial formats and also make possible to write your own implementation of JSON
0๏ธโฃ or another format without unnecessary dependency on the default one.In 1.0.0-RC2,
Json
class and related entities are located inkotlinx-serialization-json
artifact.
To migrate, simply replacekotlinx-serialization-core
dependency with-json
. Core library then will be included automatically
as the transitive dependency.For most use-cases, you should use new
kotlinx-serialization-json
artifact. Usekotlinx-serialization-core
if you are
writing a library that depends on kotlinx.serialization in a format-agnostic way of provides its own serial format.๐ง
encodeDefaults
flag is now set tofalse
in the default configuration for JSON, CBOR and Protocol Buffers.The change is motivated by the fact that in most real-life scenarios, this flag is set to
false
anyway,
๐ง because such configuration reduces visual clutter and saves amount of data being serialized.
0๏ธโฃ Other libraries, like GSON and Moshi, also have this behavior by default.0๏ธโฃ This may change how your serialized data looks like, if you have not set value for
encodeDefaults
flag explicitly.
We anticipate that most users already had done this, so no migration is required.
๐ง In case you need to return to the old behavior, simply addencodeDefaults = true
to your configuration while creatingJson/Cbor/ProtoBuf
object.๐ฆ Move
Json.encodeToDynamic/Json.decodeFromDynamic
functions to json package๐ Since these functions are no longer exposed via
DynamicObjectParser/Serializer
and they are nowJson
class extensions,
๐ฆ they should be moved tokotlinx.serialization.json
package.
To migrate, simply addimport kotlinx.serialization.json.*
to your files.๐ Bugfixes and improvements
- 0๏ธโฃ Do not provide default implementation for serializersModule in AbstractEncoder/Decoder (#1089)
- ๐ Support JsonElement hierarchy in
dynamic
encoding/decoding (#1080) - ๐ Support top-level primitives and primitive map keys in
dynamic
encoding/decoding - ๐ Change core annotations retention (#1083)
- ๐ Fix 'Duplicate class ... found in modules' on Gradle != 6.1.1 (#996)
- ๐ Various documentation clarifications
- ๐ Support deserialization of top-level nullable types (#1038)
- ๐ป Make most serialization exceptions eligible for coroutines exception recovery (#1054)
- Get rid of methods that do not present in Android API<24 (#1013, #1040)
- Throw JsonDecodingException on empty string literal at the end of the input (#1011)
- โ Remove new lines in deprecation warnings that caused errors in ObjC interop (#990)