Trying to set Ktor's client body as Array<MyClass> gives me
java.lang.ClassCastException: [LMyClass; cannot be cast to MyClass
If i just set body as MyClass it works fine
Not sure what i'm doing wrong
t
tylerwilson
02/10/2022, 9:40 PM
My experience is that Ktor tries to follow what standards exist, and in general a POST JSON body should be an object at the root, not an array. Even if some systems support it, that is what I expect is happening. Perhaps wrapping in a JsonArray would work?
l
Lucas
02/10/2022, 10:51 PM
Unfortunatelly i dont control the server.
Calling .toList() worked tho. Thanks
a
Aleksei Tirman [JB]
02/11/2022, 8:34 AM
What serialization/deserialization library do you use?