How do I serialize/deserialize to/from a simple St...
# serialization
r
How do I serialize/deserialize to/from a simple String using
kotlinx.serialization
?
Oh, I need to use a serialization format, obviously. I was trying to autocomplete from a serializer directly.
t
Here's a bit of a shortcut...
Copy code
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonConfiguration

val j = Json(JsonConfiguration.Default)
j.parseJson("\"blah\"")
will return a
JsonLiteral
representing the string
"blah"
. Leave off the escaped quotes for booleans and numbers.