Trying to set Ktor's client body as Array<MyCla...
# ktor
l
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
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
Unfortunatelly i dont control the server. Calling .toList() worked tho. Thanks
a
What serialization/deserialization library do you use?