Anyone worked with deserializing a map? Guessing ...
# ktor
p
Anyone worked with deserializing a map? Guessing a custom serializer is needed.
s
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
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