I am trying to get the example code to work listed...
# ktor
s
I am trying to get the example code to work listed here: Json - Clients - Ktor , notable:
Copy code
val client = HttpClient(HttpClientEngine) {
    install(JsonFeature) {
        serializer = GsonSerializer()
    }
}
but theres an issue with
HttpClient(HttpClientEngine)
The error says
HttpClientEngine
does not have a companion object, thus must be initialized here, what am I doing wrong?
i
I think you should use an implementation of HttpClientEngine. U can find all available client at this link https://ktor.io/clients/http-client/engines.html
☝️ 1
s
that was right, i didnt realize that HttpClientEngine was just a placeholder for the engine you wanted to use
👍 1
On another note, I am getting back a result now, of a valid json object, but when I convert it to a json string with Gson its adding whitespace everywhere (\r\n) everywhere, any ideas?
the file itself does have whitespace in it
i
I think the problem is in the configuration of your gson instance. did you add prettyprinting() to your gsonbuilder?
s
no, i hadnt, thanks a lot!