Shan
10/18/2019, 7:52 PMsetListMapper()
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.Dominaezzz
10/18/2019, 8:07 PMShan
10/18/2019, 8:09 PMDominaezzz
10/18/2019, 8:10 PMMatrixJson
with Json
and should work for you.Shan
10/18/2019, 8:15 PMsetListMapper
function for their Kotlinx.Serializer json feature, which is just appending the .list
onto the KSerializer internally. It seems to be made for this use case. š¤Unfortunately, top-level lists are supported only for serialization in ktor.
The deserialization will be supported in 1.3.40 on jvm and 1.3.50 on other platforms.
not sure if the functionality was added however. Snooping around..Dominaezzz
10/18/2019, 8:23 PM