dambakk
01/28/2020, 2:46 PMval userIds: List<MemberInput> = listOf(...)
val json: JsonElement = Json.nonstrict.toJson(MemberInput.serializer().list, userIds)
<http://client.post|client.post><HttpResponse> {
header("Content-Type", "application/json")
header("Accept", "*/*")
body = json
}
This gives me an exception when setting it as the body to the request: java.lang.ClassCastException: kotlinx.serialization.json.JsonObject cannot be cast to java.lang.String
. (I should be able to set the userIds
as body out of the box, but for debugging purposes…)
First; is this a kotlinx.serialization or a ktor issue? Secondly; what’s wrong? 🙂 I appreciate any help! 🙂Nikky
01/29/2020, 10:48 AMval client = HttpClient(HttpClientEngine) {
install(JsonFeature) {
serializer = KotlinxSerializer()
}
}
like soNikky
01/29/2020, 10:49 AM@Serializable
and it should workdambakk
01/29/2020, 11:59 AMdambakk
01/29/2020, 12:00 PMNikky
01/29/2020, 11:14 PMdambakk
01/30/2020, 11:24 AM