diff options
author | Leonid Startsev <sandwwraith@users.noreply.github.com> | 2024-02-16 14:40:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-16 14:40:54 +0100 |
commit | 5b28d33ab2d2e930db007a76b7ad91a2344c1445 (patch) | |
tree | dc6bb6fc7045f8760b9b4d41e44d172f8f7a14aa | |
parent | ab644225d3101625ca0ba22511b749571af11335 (diff) | |
download | kotlinx.serialization-5b28d33ab2d2e930db007a76b7ad91a2344c1445.tar.gz |
Actualize lenient mode documentation (#2568)
Because after #2440 quoted boolean values are allowed by default, and
quoted numbers were allowed even before that.
-rw-r--r-- | docs/json.md | 2 | ||||
-rw-r--r-- | formats/json/commonMain/src/kotlinx/serialization/json/Json.kt | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/docs/json.md b/docs/json.md index eaa2b797..c637eb1b 100644 --- a/docs/json.md +++ b/docs/json.md @@ -95,7 +95,7 @@ It gives the following nice result: ### Lenient parsing By default, [Json] parser enforces various JSON restrictions to be as specification-compliant as possible -(see [RFC-4627]). Particularly, keys must be quoted, while literals must be unquoted. Those restrictions can be relaxed with +(see [RFC-4627]). Particularly, keys and string literals must be quoted. Those restrictions can be relaxed with the [isLenient][JsonBuilder.isLenient] property. With `isLenient = true`, you can parse quite freely-formatted data: ```kotlin diff --git a/formats/json/commonMain/src/kotlinx/serialization/json/Json.kt b/formats/json/commonMain/src/kotlinx/serialization/json/Json.kt index e09b9edc..2a144fef 100644 --- a/formats/json/commonMain/src/kotlinx/serialization/json/Json.kt +++ b/formats/json/commonMain/src/kotlinx/serialization/json/Json.kt @@ -254,11 +254,10 @@ public class JsonBuilder internal constructor(json: Json) { /** * Removes JSON specification restriction (RFC-4627) and makes parser - * more liberal to the malformed input. In lenient mode quoted boolean literals, - * and unquoted string literals are allowed. + * more liberal to the malformed input. In lenient mode, unquoted JSON keys and string values are allowed. * * Its relaxations can be expanded in the future, so that lenient parser becomes even more - * permissive to invalid value in the input, replacing them with defaults. + * permissive to invalid values in the input. * * `false` by default. */ |