got a bit of a problem with creating a data class. First post, and a bit of a noob - be gentle :)
I'm trying to create a Kotlin data class to handle some responses from an API we use; the response of which looks a bit like this:
"data": {
"devices": {
"600": [
{
"device_id": "[deviceId]", ...
What I'm having trouble with is the "600" bit - I can't find a way to create the data class with this as a parameter. Each time I declare the var/val - it's throwing an error, but doesn't provide any helpful options in the IDE. All the rest are strings, so "devices" becomes "val devices: String" and so on. But in this case the val is an Int, and I don't know how to declare this in the data class.
I want to have the API response re-worked to something more easily defined, but that'll take time. Can anyone tell me how I can pass the Int as the parameter?
This is the data class:
data class SimRetrieveDevicesResponse(
val data: Devices,
val error: String? = null,
)
data class Devices(
val 600: List<DeviceInfo>? = null
)
data class DeviceInfo(
val device_id: String,
val device_type: String,
val network_id: String,
val send_period_sec: Int,
val loss_in_thousand: Int,
val tti_application_id: String,
val cmt_tenant_id: String,
)
Sorry I've called anything the wrong name...
devicesmight just be aMap<Int, List<Something>>, then it is not a parameter, just akeyin a map.