Hi guys, post upgrade from 1.6 to 2.0 , running in...
# ktor
s
Hi guys, post upgrade from 1.6 to 2.0 , running into an error, calls fail with
Serializer for class 'JsonLiteral' is not found.
Mark the class as @Serializable or provide the serializer explicitly.HttpClientUtils
Request is of type
JsonElement
. Anyone faced something similar / any leads to look into.
1
a
This discussion may help you.
🙏 1
👀 1
s
Error and use case is similar. We were sending
Json.decodeFromString(query)
as body. From the discussion in the link. I gather we need to
Copy code
You can either cast it or have a parameter with a concrete type
a
You can make a reified type parameter to solve your problem if you have a parameter of
Any
type.
s
Casting works for us on android as suggested in the discussion
Copy code
setBody(postBody as JsonObject)
But, strangely fails for ios in our KMM setup.
The ios issue also came up post the upgrade but was not related to the the above discussion