v1.1.0-RC
版本发布时间: 2021-02-04 19:16:30
Kotlin/kotlinx.serialization最新发布版本:v1.7.2(2024-08-29 01:45:05)
This is a release candidate of 1.1.0 version. Note that final 1.1.0 version may include more features and bugfixes, which would be listed in the corresponding changelog.
Kotlin version requirement updated
Due to changes in calling conventions between compiler plugin and serialization core runtime, this release requires Kotlin version at least 1.4.30-M1 (we recommend using 1.4.30 release version). However, these changes should not affect your code, because only deprecated functions were removed from public API. See corresponding PR for the details.
Experimental support for inline classes (IR only)
Using 1.1.0-RC, you can mark inline classes as @Serializable
and use them in other serializable classes.
Unsigned integer types (UByte
, UShort
, UInt
and ULong
) are serializable as well and have special support in JSON.
This feature requires Kotlin compiler 1.4.30-RC and enabling new IR compilers for JS and JVM.
You can learn more in the documentation and corresponding pull request.
Other features
- Add
serializerOrNull
function forKType
andType
arguments (#1164) - Allow shared prefix names in
Properties
(#1183) (thanks to TorRanfelt) - Add support for encoding/decoding
Properties
values as Strings (#1158) (thanks to daniel-jasinski)
Bugfixes and performance improvements
- Support contextual serialization for derived classes (#1277) (thanks to Martin Raison)
- Ensure serialization is usable from K/N background thread (#1282)
- Fail on primitive type overflow during
JsonElement
deserialization (#1300) - Throw
SerializationException
instead of ISE when encountering an invalid boolean in JSON (#1299) - Optimize the loop for writing large varints in
ProtoBuf
(#1294) - Fix serializing property with custom accessors and backing field (#1197)
- Optimize check for missing fields in deserialization and improve
MissingFieldException
message (#1153) - Improved support of nullable serializer in
@UseSerializers
annotation (#1195) - Correctly escape keys in
JsonObject.toString()
(#1246) (thanks to Karlatemp) - Treat
Collection
asArrayList
in serializer by type lookups (#1257) - Do not try to end structure in encode/decode structure extensions if an exception has been thrown, so the original exception will be propagated (#1201)
- Properly cache serial names in order to improve performance of JSON parser with strict mode (#1209)
- Fix dynamic serialization for nullable values (#1199) (thanks to ankushg)