diff options
author | Leonid Startsev <sandwwraith@gmail.com> | 2019-04-12 16:49:15 +0300 |
---|---|---|
committer | Leonid Startsev <sandwwraith@gmail.com> | 2019-04-12 16:49:15 +0300 |
commit | c48819e1accef6c5932e78536f9430a30f29263a (patch) | |
tree | 0592ca19ebcb08ca2ca4970bfc3f645b82869e9a /docs | |
parent | 0f359d0b1ac4c87e6f0252129bca9cf20176a155 (diff) | |
parent | 61ea4f258f9f472e37e10d0b36508da757bfc7ac (diff) | |
download | kotlinx.serialization-c48819e1accef6c5932e78536f9430a30f29263a.tar.gz |
Merge branch 'master' into devupstream/v0.11.0
Diffstat (limited to 'docs')
-rw-r--r-- | docs/custom_serializers.md | 4 | ||||
-rw-r--r-- | docs/runtime_usage.md | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/docs/custom_serializers.md b/docs/custom_serializers.md index 79f38af0..c5878eef 100644 --- a/docs/custom_serializers.md +++ b/docs/custom_serializers.md @@ -114,7 +114,7 @@ override fun deserialize(input: Decoder): BinaryPayload { } ``` -You can see it in action [in tests](https://github.com/kotlin/kotlinx.serialization/blob/a4c41392bb735a36788db1d789ec60afdbad3ca8/runtime/common/src/test/kotlin/kotlinx/serialization/features/BinaryPayloadExampleTest.kt). Other useful examples from tests are [custom serializers which can omit some fields](https://github.com/Kotlin/kotlinx.serialization/blob/eap13/runtime/common/src/test/kotlin/kotlinx/serialization/CustomSerializersTest.kt#L67) and [custom serializer which uses ability to read JSON as tree](https://github.com/Kotlin/kotlinx.serialization/blob/master/runtime/jvm/src/test/kotlin/kotlinx/serialization/formats/json/JsonTreeAndMapperTest.kt#L35). +You can see it in action [in tests](https://github.com/kotlin/kotlinx.serialization/blob/a4c41392bb735a36788db1d789ec60afdbad3ca8/runtime/common/src/test/kotlin/kotlinx/serialization/features/BinaryPayloadExampleTest.kt). Another useful example from tests is [custom serializer which uses ability to read JSON as tree](https://github.com/Kotlin/kotlinx.serialization/blob/master/runtime/common/src/test/kotlin/kotlinx/serialization/json/JsonTreeAndMapperTest.kt#L35). *Note:* this approach is not working for generic classes, see below. @@ -180,7 +180,7 @@ Note that we haven't applied `@Serializable` on the class, because we can't cust *Current limitation*: Because primary constructor in such case is generated by the compiler itself, not the plugin, you have to override `descriptor` manually since it can't be initialized in non-synthetic constructor. -See full sample [here](https://github.com/kotlin/kotlinx.serialization/blob/a4c41392bb735a36788db1d789ec60afdbad3ca8/runtime/jvm/src/test/kotlin/kotlinx/serialization/features/GenericCustomSerializerTest.kt). *Note*: is is broken on JS for now ([#244](https://github.com/Kotlin/kotlinx.serialization/issues/244)). +See full sample [here](https://github.com/kotlin/kotlinx.serialization/blob/a4c41392bb735a36788db1d789ec60afdbad3ca8/runtime/jvm/src/test/kotlin/kotlinx/serialization/features/GenericCustomSerializerTest.kt). ## Using custom serializers diff --git a/docs/runtime_usage.md b/docs/runtime_usage.md index 943e7830..9ccd70be 100644 --- a/docs/runtime_usage.md +++ b/docs/runtime_usage.md @@ -119,7 +119,7 @@ inline fun <reified T : Any> parse(str: String): T = parse(T::class.serializer() `stringify` transforms object to string, `parse` parses. No surprises. -Besides this, functions `toJson` and `fromJson` allow converting @Serializable Kotlin object to and from [abstract JSON syntax tree](https://github.com/Kotlin/kotlinx.serialization/blob/master/runtime/common/src/main/kotlin/kotlinx/serialization/json/JsonElement.kt#L28). To build JSON AST from String, use `parseJson`. +Besides this, functions `toJson` and `fromJson` allow converting @Serializable Kotlin object to and from [abstract JSON syntax tree](https://github.com/Kotlin/kotlinx.serialization/blob/master/runtime/common/src/main/kotlin/kotlinx/serialization/json/JsonElement.kt). To build JSON AST from String, use `parseJson`. You can also use one of predefined instances, like `Json.plain`, `Json.indented`, `Json.nonstrict` or `Json.unquoted`. API is duplicated in companion object, so `Json.parse(...)` equals to `Json.plain.parse(...)`. @@ -179,7 +179,7 @@ Other known issues and limitations: * Packed repeated fields are not supported More examples of mappings from proto definitions to Koltin classes can be found in test data: -[here](../runtime/jvm/src/test/proto/test_data.proto) and [here](../runtime/jvm/src/test/kotlin/kotlinx/serialization/formats/RandomTests.kt#L47) +[here](../runtime/jvm/src/test/proto/test_data.proto) and [here](../runtime/jvm/src/test/kotlin/kotlinx/serialization/formats/RandomTests.kt) ## Useful classes |