Omer Amiel
07/15/2022, 5:05 AMGson
in the ContentNegotiation
block?
This doesn’t work:
val gsonInstance: Gson = ...
install(ContentNegotiation) {
gson {
gsonInstance
setPrettyPrinting()
setLenient()
}
}
Aleksei Tirman [JB]
07/15/2022, 9:18 AMval gsonInstance: Gson = GsonBuilder().apply {
setPrettyPrinting()
setLenient()
}.create()
embeddedServer(Netty, port = 4444) {
install(ContentNegotiation) {
val converter = GsonConverter(gsonInstance)
register(ContentType.Application.Json, converter)
}
}