MyGit

v1.0.0-RC2

Kotlin/kotlinx.serialization

版本发布时间: 2020-09-21 23:29:27

Kotlin/kotlinx.serialization最新发布版本:v1.7.2(2024-08-29 01:45:05)

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 as Json serial format. We've decided to change that and to make core 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 or another format without unnecessary dependency on the default one.

In 1.0.0-RC2, Json class and related entities are located in kotlinx-serialization-json artifact. To migrate, simply replace kotlinx-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. Use kotlinx-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 to false 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. Other libraries, like GSON and Moshi, also have this behavior by default.

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 add encodeDefaults = true to your configuration while creating Json/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 now Json class extensions, they should be moved to kotlinx.serialization.json package. To migrate, simply add import kotlinx.serialization.json.* to your files.

Bugfixes and improvements

相关地址:原始地址 下载(tar) 下载(zip)

查看:2020-09-21发行的版本