https://kotlinlang.org logo
#serialization
Title
# serialization
l

Lulu

12/12/2018, 9:28 AM
How to debug this:
kotlinx.serialization.json.JsonParsingException: Invalid JSON at 1221: Expected '[, kind: kotlinx.serialization.UnionKind$POLYMORPHIC@1e6d1014'
s

sandwwraith

12/12/2018, 10:13 AM
This happens because parser was expecting array of [typeName, object] for polymorphic deserialization
l

Lulu

12/12/2018, 11:05 AM
How could I know why it was expecting that?
n

Nikky

12/12/2018, 11:12 AM
you have something that takes alist of objects but it cannot be sure which classes are serializable.. there might be multiples
so it would make a array with the first element being the type hint
l

Lulu

12/12/2018, 11:58 AM
Thanks I think I figured it out
30 Views