Skip to content

Commit 5084435

Browse files
authored
Improved docs for JsonContentPolymorphicSerializer (#2189)
Relates #834
1 parent 350443a commit 5084435

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

formats/json/commonMain/src/kotlinx/serialization/json/JsonContentPolymorphicSerializer.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,12 @@ import kotlin.reflect.*
5555
*
5656
* // Now both statements will yield different subclasses of Payment:
5757
*
58-
* Json.parse(PaymentSerializer, """{"amount":"1.0","date":"03.02.2020"}""")
59-
* Json.parse(PaymentSerializer, """{"amount":"2.0","date":"03.02.2020","reason":"complaint"}""")
58+
* Json.decodeFromString(PaymentSerializer, """{"amount":"1.0","date":"03.02.2020"}""")
59+
* Json.decodeFromString(PaymentSerializer, """{"amount":"2.0","date":"03.02.2020","reason":"complaint"}""")
6060
* ```
6161
*
62-
* @param T A root class for all classes that could be possibly encountered during serialization and deserialization.
62+
* @param T A root type for all classes that could be possibly encountered during serialization and deserialization.
63+
* Must be non-final class or interface.
6364
* @param baseClass A class token for [T].
6465
*/
6566
@OptIn(ExperimentalSerializationApi::class)

0 commit comments

Comments
 (0)