Shan
10/14/2019, 11:00 PMj.b.u: Can't locate argument-less serializer for class e.b.b.d.a (Kotlin reflection is not available). For generic classes, such as lists, please provide serializer explicitly.
Can anyone confirm that this means I have to write my own serializer because it's using a Map
? Or is there a way to do this that I'm missing somewhere? I'm using this with a Ktor request.Dominaezzz
10/14/2019, 11:13 PMDominaezzz
10/14/2019, 11:13 PMDominaezzz
10/14/2019, 11:13 PMShan
10/14/2019, 11:16 PMShan
10/14/2019, 11:16 PMinstall(JsonFeature) {
serializer = KotlinxSerializer()
}
Shan
10/14/2019, 11:17 PM@Serializable
data class Request(
val flags: Array<String>,
val userInfo: UserAttributes
)
Shan
10/14/2019, 11:17 PM@Serializable
data class UserAttributes(
val booleanAttributes: Map<String, Boolean>,
val numberAttributes: Map<String, Float>,
val stringAttributes: Map<String, String>
)
Shan
10/14/2019, 11:18 PMDominaezzz
10/15/2019, 9:39 AMDominaezzz
10/15/2019, 9:40 AMShan
10/16/2019, 5:57 PMserializer()
from Kotlinx.Serialization, and was instead trying to use reflection to find it but could not. I set it explicitly with setMapper(KClass, KSerializer)
and it is now working, though I do wonder why Ktor does not find the KSerializer without me explicitly setting it seeing as it is always generated when something is annotated with @serialized
.. 🤔