Hi, I’m using ktor’s `ParametersBuilder` to build ...
# ktor
s
Hi, I’m using ktor’s
ParametersBuilder
to build params from JsonObject and I see that double quotes are added to my query params’ values. Can someone help me in correcting or handling this ?
Attaching the code here -
Copy code
val jsonObject = this.httpApiClient.json.encodeToJsonElement(
            kClass.serializer(),
            params
        ).jsonObject
        val parametersBuilder = ParametersBuilder(10, UrlEncodingOption.NO_ENCODING)
        jsonObject.entries.forEach { it ->
            this.appendParameter(
                parametersBuilder,
                null,
                it.key,
                it.value
            )
        }
and appendParamater basically does this. -
Copy code
when (value) {
            is JsonNull -> Unit
            is JsonPrimitive -> builder[finalKey] = value.jsonPrimitive.content
            is JsonArray -> builder.appendAll(
                finalKey,
                value.jsonArray.map { it.jsonPrimitive.content })
a
Could you please tell me for what types of JSON values your parameters contain double quoted values? How do you check that they are quoted? What version of Ktor do you use?
175 Views