Thread
#serialization
    r

    ribesg

    3 years ago
    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

    Toddobryan

    3 years ago
    Here's a bit of a shortcut...
    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.