Hi there, I'm using Retrofit with Serialization on Android. I'm trying to parse a Json object which ...
d
Hi there, I'm using Retrofit with Serialization on Android. I'm trying to parse a Json object which contains a
data
object. The type of
data
is defined by
isTypeA
or
isTypeB
within the object itself. (See sample in thread). I was thinking about using a sealed class. Is there a way to specify using annotations that the type of the object should be defined by a value within that object?
Sample:
Copy code
{
  "data": {
    "isTypeA": 1
    ...
  }
}
Copy code
{
  "data": {
    "isTypeB": 1
    ...
  }
}
e
d
Oh great, thanks!
Mmh, turns out as useful as JsonContentPolymorphicSerializer is, it doesn't seem to support nullable types