Hi, while calling ktor API, if my query is of different type, I’m getting below exception
java.lang.IllegalStateException: Serializing collections of different element types is not yet supported. Selected serializers: [kotlin.String,
kotlin.Int]
val query = hashMapOf<String,Any>(
KEY_OTP to otp.toInt(),
KEY_MOBILE to phone
)
This is what I’ve posted
However I achieved the excepted result by sending a model class as
@Serializable
data class OTPRequest(
val mobile : String,
val otp : Int
)
But I was wondering, It’ll be a extra burden if I’m going to create multiple request classes
Any solution will be helpful.
thanks