Nikky

    Nikky

    3 years ago
    does anyone have a working example of how to serialize sealed classes? for me i just get empty json objects when i use
    BaseClass.serializer()
    Dominaezzz

    Dominaezzz

    3 years ago
    I don't have a self-contained one.
    Have you marked the class as
    @Polymorphic
    nd stuff?
    Nikky

    Nikky

    3 years ago
    i got it sorted, it turns out
    @Polymorphic
    does not affect
    sealed
    , but once i replaced it with
    abstract class
    it works
    * Does not affect sealed classes, because they are gonna be serialized with subclasses automatically
     * with special compiler plugin support which would be added later.
    Dominaezzz

    Dominaezzz

    3 years ago
    Even,
    @Serializable(PolymorphicSerializer::class)
    ?
    That's what I use, rather.
    Nikky

    Nikky

    3 years ago
    where do i put this ? on the base class ?
    Dominaezzz

    Dominaezzz

    3 years ago
    Yup
    Nikky

    Nikky

    3 years ago
    and that worked
    Dominaezzz

    Dominaezzz

    3 years ago
    Sweet!