Hi, I am using ktor server ContentNegotiation feat...
# ktor
m
Hi, I am using ktor server ContentNegotiation features setup like this
Copy code
install(ContentNegotiation) {
        json()
    }
on the client side, I use kotlinx-serialization to serialize a sealed class and post it to server but it doesn't work because the kotlinx-serialization produces different format than ktor-server expects. I thought they are supposed to use the same format. What is the way to make them work together?
For now, I hacked it by changing
Copy code
post<MyDto> { myDto -> 
   //stuff
}
to
Copy code
post { 
   val myDto = mySerializer.parse<MyDto>(call.receiveText())
   //stuff
}
k
why do you need now ContentNegotiation? you are doing mapping by hands now
m
yes, but I don't want to - I wanted to use the contentNegotiation feature, but it doesn't work as I expected
k
the same for me 😞