https://kotlinlang.org logo
Title
s

Salman

01/26/2023, 12:24 PM
Hi, everyone I am trying to deserialize the api response in kotlin/js but so far I have figured out that to deserialize the response I have to create the response object( data class), I am only interested in 2 properties from the response object and for that I have to declare the complete object with all properties on my side, kotlin/js is not allowing me to deserialize it to dynamic type, any thoughts how to do it?
t

turansky

01/26/2023, 1:34 PM
for that I have to declare the complete object with all properties
You can ignore unknown keys with custom
Json
:
private val defaultJson: Json = Json {
    ignoreUnknownKeys = true
}

defaultJson.decodeFromString(...)
s

Salman

01/27/2023, 6:56 PM
Thank you so much @turansky, it worked 🙂