• altavir

    altavir

    3 years ago
    I am trying to find an example of working Polymorphic serialization with sealed class hierarchy and for now found only some scraps in commit history of kotlinx.serialization. Do anybody have a reference. My class hierarchy looks like this https://pastebin.com/59usEBxS and I need to have a List of those, which will be transformed into XML (via @pdvrieze plugin) and read back depending on tag name.
    altavir
    3 replies
    Copy to Clipboard
  • Fudge

    Fudge

    3 years ago
    Is there a way to pretty-print a
    JsonObject
    in kotlinx.serialization ?
    Fudge
    r
    3 replies
    Copy to Clipboard
  • r

    Rostislav Utrobin

    3 years ago
    When kotlinx.serialization support (to CBOR format) for native (ios) is expected?
    r
    1 replies
    Copy to Clipboard
  • t

    thana

    3 years ago
    is there any way to debug bad bytecode generated by the serialization plugin?
    t
    s
    2 replies
    Copy to Clipboard
  • e

    efemoney

    3 years ago
    I don’t how to repro this but I had an issue uploading a build of my app to the Google playstore and it turned out to be a problem with applying the serialization plugin. In my case, I applied the serialization plugin to an android library module that the main app module depended on and uploading the app to the google play store failed with “some parts of the apk were not signed correctly” (paraphrasing)
    e
    s
    +1
    9 replies
    Copy to Clipboard
  • p

    PHondogo

    3 years ago
    Hello! Does inheritance supported? For example: class A { .... } class B : A { .... } val a : A = deserialize(serialize(B())) // a has runtime type of B
    p
    1 replies
    Copy to Clipboard
  • t

    Toddobryan

    3 years ago
    Where does the code that does the annotation processing live in the serialization repo? I can't find it anywhere?
    t
    j
    +1
    8 replies
    Copy to Clipboard
  • w

    william

    3 years ago
    are there any android libraries that work with androidx serialization out of the box?
    w
    itnoles
    5 replies
    Copy to Clipboard
  • Paulius Ruminas

    Paulius Ruminas

    3 years ago
    Hello, currently I'm using
    PolymorphicSerializer
    for sealed class like this
    @Serializable(PolymorphicSerializer::class)
    sealed class Response {
    
        @Serializable
        data class Success(val token: Token) : Response()
            
        // serializer defined in serial module
        object Failure : Response()
    }
    I found this section in doc comment of
    @Polymorphic
    annotation.
    Does not affect sealed classes, because they are gonna be serialized with subclasses automatically with special compiler plugin support which would be added later.
    At first I thought I could use
    @Polymorphic
    instead of
    @Serializable(PolymorphicSerializer::class)
    but it does not work that way. Will this approach change in the future?
    Paulius Ruminas
    s
    5 replies
    Copy to Clipboard
  • alex009

    alex009

    3 years ago
    hi all! can anyone help me with enum serialization? i have enum values 1,2,3,4 and write this enum:
    enum class Status {
        @SerialName("1")
        ACTIVE,
        @SerialName("2")
        BLOCKED,
        @SerialName("3")
        WAIT_UPDATE_PROFILE,
        @SerialName("4")
        WAIT_APPROVE;
    }
    but serialization can't parse Status:
    kotlinx.serialization.SerializationException: com.icerockdev.generated.ktor.models.RelativeProfileResponse.Status does not contain element with name '1'
    enums not support
    @SerialName
    ?
    alex009
    s
    4 replies
    Copy to Clipboard