Hi guys, I'm using Ktor as a server, for contentNegotiation I'm using jackson and I was wondering how can we add custom ContentType to make jackson accept for example
application/vnd.api+json
that in the end is also Json ?
My current settings for ContentNegotiation
Copy code
install(ContentNegotiation) {
jackson {
enable(SerializationFeature.INDENT_OUTPUT)
disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
registerKotlinModule()
}
}
t
tjohnn
11/29/2019, 12:56 PM
Try this:
Copy code
val type = ContentType("application", "vnd.api+json")
install(ContentNegotiation) {
register(type, JacksonConnverter())
jackson {
enable(SerializationFeature.INDENT_OUTPUT)
disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
registerKotlinModule()
}
}