Very new to Ktor and Kotlin. Can I use kotlinx ser...
# ktor
j
Very new to Ktor and Kotlin. Can I use kotlinx serialization in a ktor rest api server? I installed the ktor plugin in IntelliJ IDEA, when creating a new ktor project, there is no Serialization under “Content Negotiation”, it has GSON, Jackson and ContentNegotiation. I just need to convert between class object and Json. Thought of using serialization as already tested it in KMP mobile app. Is serialization not suitable on server? Or I just need to manually add the dependency to my ktor server project?
t
Yes, you need to manually add it
j
Thanks. Just wondering why it’s own serialization package is not in the ktor plugin template. Could be confusing to newbie like me who reach ktor after KMP project.
g
I understand your confusion. But please bear in mind that modularity is one of the core features (and imo also one of the biggest strengths!) of ktor. You want kotlinx serialization? Sure, you can have it - just include the appropriate package. But there's no point in including it if you may use GSON just as well.
Otherwise, this would imply shipping a huge bulk of unused software parts with the core packages.
j
Thanks understood