Kotlin在不知道密钥的情况下对Json对象进行解析

Kotlin在不知道密钥的情况下对Json对象进行解析,json,kotlin,retrofit2,Json,Kotlin,Retrofit2,我们的服务器API返回的响应为: { "22397": { "granted": 1597078582, "expires": 0, "type": "video", "product_nid": 4029080241 }, "22313": { &quo

我们的服务器API返回的响应为:

{
    "22397": {
        "granted": 1597078582,
        "expires": 0,
        "type": "video",
        "product_nid": 4029080241
    },
    "22313": {
        "granted": 1594318970,
        "expires": 0,
        "type": "video",
        "product_nid": 40208744145
    }
}
这里我们不知道“22397”或“22313”,它们是动态的。
使用Android Kotlin和Refught2。

你能展示一个代码示例吗?也请检查这一点(imho,你应该停止对这些对象使用Refught2,只使用JSONObject,或者如果可能的话,切换到后端的另一个JSON结构)