ok I'm new to Ktor and I'm learning about it, one thing that I faced in this progress was this error : kotlinx.serialization.SerializationException: Serializer for class 'FreeMarkerContent' is not found. Mark the class as @Serializable or provide the serializer explicitly
and thats becouse in my code, Im using FreeMakcerContent and its trying to Serlialize it :
get {
call.respond(FreeMarkerContent("index.ftl", mapOf("articles" to articles)))
}
how can I fix this problem?
I faced the same problem and I fixed it by installing FreeMarker plugin before installing ContentNegotiation plugin.
install(FreeMarker) {
templateLoader = ClassTemplateLoader(this::class.java.classLoader, "templates")
}
install(ContentNegotiation) {
json()
}
routing {
get("/html-freemarker") {
call.respond(FreeMarkerContent("index.ftl", mapOf("name" to "Shalaga"), ""))
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With