I have a payload which look like this :
{
"data": {
"12345": {
"is_indexable": true,
"description": "Lorem description",
"items": {
"id": 2644,
"name": "Naming here"
}
},
"678910": {
"is_indexable": false,
"description": "Lorem description 2",
"items": {
"id": 29844,
"name": "Naming here again"
}
}
}
}
I wanted to generate a specific data class for that payload using tools like https://transform.tools/json-to-kotlin but it's impossible since the array inside the "data" object is an ID (so a dynamic data)
data class Root(
val data_field: Data
)
data class Data(
val payload: List<Payload>, // Something to represent the dynamic ids
)
data class Payload(
val isIndexable: Boolean,
val description: String,
val items: Items
)
data class Items(
val id: Long,
val name: String
)
I don't know if I'm clear, did you have an idea to make this in a clean way ?
Thank you all !