deserialize
Deserializes the value of type EmailAddress using the format represented by the specified decoder.
See the KSerializer.deserialize function for more details.
Calling from Kotlin
Here's an example of calling this function from Kotlin code:
val deserializer = EmailAddressAsStringSerializer()
val text = "contact@kotools.org"
val encoded: String = Json.encodeToString(text)
val decoded: EmailAddress = Json.decodeFromString(deserializer, encoded)
val expected: EmailAddress = EmailAddress.orThrow(text)
assertEquals(expected, decoded)
Content copied to clipboard