<https://github.com/JetBrains/kotlinconf-app/blob/...
# serialization
j
https://github.com/JetBrains/kotlinconf-app/blob/master/common/src/commonMain/kotlin/org/jetbrains/kotlinconf/api/KotlinConfApi.kt#L16 seeing the Sourcecode of the KotlinxSerializer it does not support List<Whatever>::class as mapping argument and would internally use JSON.parse instead of JSON.parseList anyway. Is anyone aware of a smart way to support mapping of Lists using JsonFeature?
t
Just use DataClass.serializer().list as first argument
j
that would be the one for the second parameter: setMapper(???, DataClass.serializer().list) setMapper only allows a class literal as first argument
t
I haven't tested serialization, but
JSON.parse(DatabaseDelta.serializer().list, DB_DELTA)
worked for me
s
When you have only KClass<List>, you can’t tell which type of elements does it have, because generics are erased at runtime. Current workaround is to wrap your list into type. Unfortunately, we don’t have multiplatform type token (like
java.lang.Type
) for now.
j
okay, thanks for the clarification!