Are json lists deserialized in order? If so, does ...
# serialization
d
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...
d
Yes they have to be in order. Dunno what yaml plugin you're talking about.
d
d
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.
d
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
Are you asking hypothetically if
charlsekorn/kaml
preserves order, or have you experienced order not being preserved?
d
experienced...
d
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.