Search code examples
gsonkotlin-multiplatformktorkotlin-multiplatform-mobile

How to get to use GsonSerializer for ktor?


In https://ktor.io/docs/json.html#gson, I can see we can have GsonSerialzer as the code

install(JsonFeature) {
    serializer = GsonSerializer() {
        setPrettyPrinting()
        disableHtmlEscaping()
    }
}

But I can't seem to get to include this class. Which library should I import (in my Gradle) to have access to them?


Solution

  • implementation "io.ktor:ktor-client-gson:$ktor_version"
    

    From the docs