dave08

    dave08

    4 months ago
    Are json lists deserialized in order? If so, does the yaml plugin make kotlinx serialization lose that order? And is there any way to make sure the order is kept? Our source files are in yaml and need to be deserialized to kotlin data classes in a very specific order...
    Dominaezzz

    Dominaezzz

    4 months ago
    Yes they have to be in order. Dunno what yaml plugin you're talking about.
    dave08

    dave08

    4 months ago
    Dominaezzz

    Dominaezzz

    4 months ago
    Ah I see. That's not a "plugin", which is why I was confused.
    Order should be maintained but you'll have to file an issue there.
    dave08

    dave08

    4 months ago
    Yeah, I'm new to kotlinx serialization, so I didn't have the chance to get used to the terminology. So it depends on that library and not on kotlinx serialization core?
    Good to know that I can't assume this behavior... I'll have to add unit tests for this too... at least until that lib takes care of it, if possible...
    a

    Adam S

    4 months ago
    Are you asking hypothetically if
    charlsekorn/kaml
    preserves order, or have you experienced order not being preserved?
    dave08

    dave08

    4 months ago
    experienced...
    Dominaezzz

    Dominaezzz

    4 months ago
    The built in list serialiser maintains the order between serialisation and deserialisation but there's no guarantees on what the format produces. The yaml library might as well store the list in reverse order for all you know.