How can I use `kotlin.serialization` in native (kt...
# ktor
a
How can I use
kotlin.serialization
in native (ktor client + curl)? Way from https://ktor.io/docs/serialization-converter.html
install(ContentNegotiation) { serialization() }
doesn’t work -
ContentNegotiation
exists only for jvm.
j
I may be misunderstanding question but am using
JsonFeature
for this
Copy code
HttpClient() {
            install(JsonFeature) {
                serializer = KotlinxSerializer(nonStrictJson)
            }
        }
m
@aleksey.tomin Hi, for me, it isn't even working on the JVM.
serialization()
is not being resolved. I have these in my build.gradle.kts:
Copy code
plugins {
    application
    kotlin("jvm") version "1.4.10"
    kotlin("plugin.serialization") version "1.4.10"
}
dependencies {   implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.0")
}
g
You also need ktor serialization dependencies https://ktor.io/docs/json-feature.html#kotlinx-serialization
a
@John O'Reilly Thank you, it works fine!
👍 1