also seems like your problem is due to directly ma...
# ktor
s
also seems like your problem is due to directly mapping query params to a data class
t
hmm
the
tags
in my example is the JSON body
s
Could you try and print tags and show us the output
t
Capture.PNG
@sp ^
s
okay well that makes sense
your class is somehow being parsed to a LinkedHashMap
t
i guess why? i was googling and it said jackson doesnt have enought information about the class but im not sure what that means
s
but it’s correctly parsing it as a list
doubt it
jackson fails with other errors
I would have a look ath documentation for the receive function
t
ill take a look
interesting
it does not work with a
List
but serializes fine if only a single object
o
Seems like the problem is that receive() loses the generic type information. Look at Extensions.kt in the jackson kotlin module, they wrap the generic information in a TypeReference. receive would have to do something similar, but I'm not sure how, since the wrapper would be specific to the content negotiation implementation.
a
t
i just commented on this but is there a workaround for this?
o
You could inject a jacksonObjectMapper directly into your controller and receive a String or byte array and parse that into your domain object.
t
i came up with this extension function
Copy code
inline fun <reified T> String.serialize(): T {
  return jacksonObjectMapper().readValue(this)
}
for those interested
usage:
Copy code
val tags = call.receiveText().serialize<List<Tag>>()