https://kotlinlang.org logo
#ktor
Title
# ktor
p

Patrick Jackson

02/26/2019, 12:02 AM
Anyone worked with deserializing a map? Guessing a custom serializer is needed.
s

Sergey Bondari

02/26/2019, 12:11 AM
Question way is too general. I assume you have a problem with Java generic type erasure. For example, if you use Jackson object mapper you may provide TypeReference object that holds information about generics. It will create Map of Strings by default. Is this what you’ve asked for?
p

Patrick Jackson

02/26/2019, 9:53 PM
Yeah, missing some info, sorry. I am using kotlin serialization in a MPP project. When making a request I get this message: "Fail to run receive pipeline: kotlinx.serialization.SerializationException: Can't locate argument-less serializer for class kotlin.collections.Map. For generic classes, such as lists, please provide serializer explicitly." Diving into implementing a serializer now, has hoping there would be example or existing code to aid with this usecase
I'm dealing with dynamic keys. The values are always the same type
3 Views