This release contains all features and bugfixes from 1.5.0-RC plus some experimental features and bugfixes on its own (see below).
Kotlin 1.8.10 is used as a default.
HoconEncoder and HoconDecoder interfaces and HOCON-specific serializers
These interfaces work in a way similar to JsonEncoder and JsonDecoder: they allow intercepting (de)serialization process,
making writing if custom HOCON-specific serializers easier. New ConfigMemorySizeSerializer and JavaDurationSerializer already make use of them.
See more details in the PR.
Big thanks to Alexander Mikhailov for contributing this!
Ability to read buffered huge strings in custom Json deserializers
New interface ChunkedDecoder allows you to read huge strings that may not fit in memory by chunks.
Currently, this interface is only implemented by Json decoder that works with strings and streams,
but we may expand it later, if there's a demand for it.
See more details in the PR authored by Alexey Sviridov.
Added support for null values for nullable enums in lenient mode (#2176)
Prevent class loaders from leaking when using ClassValue cache (#2175)
1.5.0-RC
This is a release candidate for the next version with many new features to try.
It uses Kotlin 1.8.0 by default.
Json naming strategies
A long-awaited feature (#33) is available in this release.
A new interface, JsonNamingStrategy and Json configuration property namingStrategy allow
defining a transformation that is applied to all properties' names serialized by a Json instance.
There's also a predefined implementation for the most common use case: Json { namingStrategy = JsonNamingStrategy.SnakeCase }.
Check out the PR for more details and documentation.
Json unquoted literals
kotlinx-serialization-json has an API for manipulating raw Json values: functions and classes JsonObject, JsonPrimitive, etc.
In this release, there is a new addition to this API: JsonUnquotedLiteral constructor function.
It allows to produce a string that is not quoted in the Json output. This function has a lot of valuable
applications: from writing unsigned or large numbers to embedding whole Json documents without the need for re-parsing.
For an example, read the Encoding literal Json content docs.
This huge feature was contributed to us by aSemy: #2041.
Stabilization of serializer(java.lang.Type) function family
Functions serializer, serializerOrNull and extensions SerializersModule.serializer, SerializersModule.serializerOrNull
have JVM-only overloads that accept java.lang.Type. These overloads are crucial for interoperability: with them, third-party Java frameworks
like Spring, which usually rely on Java's reflection and type tokens, can retrieve KSerializer instance and use kotlinx.serialization properly.
This release contains an important Native targets overhaul, as well as numerous enhancements and bugfixes.
Kotlin 1.8.21 is used by default.
New set of Native targets
The official Kotlin target support policy has recently been published
describing new target policy: each target belongs to a certain tier, and different tiers have different stability guarantees.
The official recommendation for library authors is to support targets up to Tier 3,
and kotlinx.serialization now follows it.
It means that in this release, there are a lot of new targets added from this tier,
such as androidNativeX86 or watchosDeviceArm64.
Note that since they belong to Tier 3, they're not auto-tested on CI.
kotlinx.serialization also ships some deprecated Kotlin/Native targets that do not belong to any tier (e.g. iosArm32, mingwX86).
We'll continue to release them, but we do not provide support for them, nor do we plan to add new targets from the deprecated list.
Improvements in Json elements
There are two new function sets that should make creating raw Json elements easier.
First one contains overloads for JsonPrimitive constructor-like function
that accept unsigned types: JsonPrimitive(1u).
Second one adds new addAll functions to JsonArrayBuilder to be used with collections
of numbers, booleans or strings: buildJsonArray { addAll(listOf(1, 2, 3)) }
Both were contributed to us by aSemy.
Other enhancements
Potential source-breaking change: Rename json-okio target variables to sink (#2226)
Function to retrieve KSerializer by KClass and type arguments serializers (#2291)
Added FormatLanguage annotation to Json methods (#2234)
Properties Format: Support sealed/polymorphic classes as class properties (#2255)
Bugfixes
KeyValueSerializer: Fix missing call to endStructure() (#2272)
This release contains all features and bugfixes from 1.5.0-RC plus some experimental features and bugfixes on its own (see below).
Kotlin 1.8.10 is used as a default.
You can trigger a rebase of this PR by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Note
Automatic rebases have been disabled on this pull request as it has been open for over 30 days.
Bumps org.jetbrains.kotlinx:kotlinx-serialization-json from 1.4.1 to 1.5.1.
Release notes
Sourced from org.jetbrains.kotlinx:kotlinx-serialization-json's releases.
... (truncated)
Changelog
Sourced from org.jetbrains.kotlinx:kotlinx-serialization-json's changelog.
... (truncated)
Commits
f833852
Prepare 1.5.1 release (#2297)a27e86f
Function to retrieve KSerializer by KClass and type arguments serializers (#2...5a8795a
Added FormatLanguage annotation to JSON (#2234)40eb277
Merge remote-tracking branch 'origin/master' into dev9157bf8
Implement addAll functions for JsonArrayBuilder (#2156)ef67bce
KeyValueSerializer: Fix missing call to endStructure() (#2272)8007574
ObjectSerializer: Respect sequential decoding (#2273)0a6eb81
Fix incorrect function name in PrimitiveSerialDescriptor doc comment (#2289)cfce5d8
Properties Format: Support sealed/polymorphic classes as class properties (#2...961e87d
Adapt tests for K2 and upcoming deprecations in K1 (#2230)You can trigger a rebase of this PR by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)