deserialize

override fun deserialize(decoder: Decoder): EmailAddress

Deserializes the value of type EmailAddress using the format represented by the specified decoder.

See the KSerializer.deserialize method for more details.


Calling from Kotlin

Here's an example of calling this method from Kotlin code:

val deserializer = EmailAddressAsStringSerializer()
val text = "[email protected]"
val encoded: String = Json.encodeToString(text)
val decoded: EmailAddress = Json.decodeFromString(deserializer, encoded)
val expected: EmailAddress = EmailAddress.orThrow(text)
assertEquals(expected, decoded)