Hi, I have the weirdest bug I ever had with `kotli...
# serialization
a
Hi, I have the weirdest bug I ever had with
kotlinx.ser
, the library absolutely wants to precise the type of an ArrayList in a JSON when in a specific class, but not in another class. I have this :
var conditions: List<Predicate>? = null
, in two different classes,
EntityOrPredicate
and
LootPool
. • In
EntityOrPredicate
, I serialize my list with a
ListSerializer
of a custom serializer, it works perfectly. • On
LootPool
, I do the exact same thing with the same custom serializer, and there, I get an additional
"type": "kotlin.collections.ArrayList
entry in the resulting JsonArray, with my Predicates serialized with the custom serializer, as waited. I really don't know why it's happening and I've tried many many many many things (I lost about 12 to 15h on this problem in total). Here is my project with the EntityOrPredicate class and the LootPool class (with the custom serializer here), it's a bit messy because I left all my tests and comments. This is a followup from our old discussion @Ben Woodworth.
s
Sounds related to my issue from January here: https://github.com/Kotlin/kotlinx.serialization/issues/2164
a
My project only needs serialization and not deserialization, I can't get it to work, if you can maybe clone the project and try things until it works it would help me a lot, I can be there for any additional information on what I expect