dagomni
05/06/2020, 12:45 PM@Serializable
sealed class Response<T> {
@Serializable
data class ResponseData<T>(
@SerialName("data")
val data: T
) : Response<T>()
@Serializable
data class AuthData(
@SerialName("data")
val data: AdditionalAuthorization?
) : Response<AdditionalAuthorization?>()
}
I get this error
Unexpected JSON token at offset 0: Expected '[, kind: SEALED'.
It fails even with the simplest json. Apart from sealed classes I've also tried interface, open, abstract - same error, different kind given in message. Is what I'm trying to achieve supported by kotlinx.serialization?Dominaezzz
05/06/2020, 2:59 PMDominaezzz
05/06/2020, 3:00 PMResponse
to be generic?Dominaezzz
05/06/2020, 3:00 PM@Serializable
sealed class Response {
@Serializable
data class ResponseData<T>(
@SerialName("data")
val data: T
) : Response()
@Serializable
data class AuthData(
@SerialName("data")
val data: AdditionalAuthorization?
) : Response()
}