I'm using external API in the app, while deserialisation is done with Kotlinx Serialization package, i'm facing issues when api result is Array of Int for multiple values and primitive int for single value. How can i avoid crash in this process. Is there better approach to avoid crashes or creating data classes
ex:
import kotlinx.serialization.Serializable
@Serializable
data class Bookings (val slots: List<Int>)
when slots is having single value API returns {slots: 1}
when slots is having multiple value API return { slots: [1,2,3,4]}