Does anyone have an example of using Ktor + Kotlinx.Serialization when getting a JsonArray back as a response? I see the
setListMapper()
and
registerList<>()
functions as part of the JsonFeature, but am unsure of how to use them, or if they are even applicable in the case of getting back an array response. Just trying to test it in a test project at the moment, this is what I have. Does my array need to be within the
@Serializable
data class itself? The format of the response is:
[
{
id: 382910,
name: "name",
isEnabled: true
},
{
//etc..
}
]
I get this error:
Can't locate argument-less serializer for interface java.util.List (Kotlin reflection is not available). For generic classes, such as lists, please provide serializer explicitly.
which makes sense but I also believe there is a way to do this without writing a custom serializer, I just can't find the info anywhere.