Hello, This is my configuration: ```//client HttpC...
# ktor
g
Hello, This is my configuration:
Copy code
//client
HttpClient(Apache) {
    install(JsonFeature) { serializer = KotlinxSerializer(Json { ignoreUnknownKeys = true }) }
}

//server
install(ContentNegotiation) {
        kotlinx.serialization.json.Json { ignoreUnknownKeys = true }
//        gson { setPrettyPrinting() }
    }
and this is a sample request:
Copy code
val response = client.get<List<Event>>("<http://localhost:8080>${application.locationToUrl(EventsApi())}") {
    body = ...
    contentType(ContentType.Application.Json)
}
and this is the output:
Copy code
invalid: 415 Unsupported Media Type. Text: ""
But if I uncomment
gson { setPrettyPrinting() }
it works… Shouldn’t
kotlinx.serialization.json.Json
be enough? 🤔
r
can you please create a minimal example and file a bug in YT?
👍 1
g
@Rustam Siniukov I’m also facing problems with
@SerialName
I don’t if its related, but the SS can parse it (when it communicates for instance with Google Api or any other service), but the web app can’t (it shows null) 🤔
found it…
Copy code
install(ContentNegotiation) {
    json(kotlinx.serialization.json.Json {
        ignoreUnknownKeys = true
        prettyPrint = true
    })
}
instead of:
Copy code
install(ContentNegotiation) {
        kotlinx.serialization.json.Json {ignoreUnknownKeys = true }
    }
👍 1