I have a data class which represents the object I'm receiving from my API :
data class MyObject(
@SerializedName("id") var id: Int,
@SerializedName("status.description") var status: String
)
This is what my JSON looks like :
{
"id": 1,
"status": {
"description": "OK"
}
}
I'm fetching these data with Retrofit using Gson
adapter but I always have my status attribute to null. Even if I use Moshi
it's still null.
How can I get this attribute from my JSON without having to create a class Status
with only one and a unique attribute named description?