android - 在改造android中解析嵌套的json对象

标签 android json retrofit

我无法在改造中解析 json,这是我的示例 json,键是动态的,这样的 json 数据需要什么 POJO 定义:

    {
    "Fri Mar 23 2018 17:35:36 GMT+0530 (IST)": {
        "PDF": "",
        "URL": "",
        "image": "",
        "shortDescription": "test one",
        "timestamp": "2018-03-23T12:05:36.319Z",
        "title": "test "
    },
    "Fri Mar 23 2018 17:44:43 GMT+0530 (IST)": {
        "PDF": "",
        "URL": "",
        "image": "",
        "shortDescription": "two test",
        "timestamp": "2018-03-23T12:14:43.194Z",
        "title": "two"
    },
    "Fri Mar 23 2018 17:49:06 GMT+0530 (IST)": {
        "PDF": "",
        "URL": "https://twitter.com/CodingDoug/status/942576182276497409",
        "image": "https://drive.google.com/open?id=1gBUaAVdAttmAqv68OChHCDqlbKAoxZW6",
        "shortDescription": "test three",
        "timestamp": "2018-03-23T12:19:06.835Z",
        "title": "three"
    },
    "Mon Mar 26 2018 15:56:06 GMT+0530 (IST)": {
        "PDF": "",
        "URL": "https://www.goodmorningquote.com/inspirational-monday-quotes-start-happy/",
        "image": "https://drive.google.com/open?id=1fg1z0_jzTUUiXhvkHyGLewJC2LFFzEyW",
        "shortDescription": "1st day of week, great day to plan and jumpstart week ",
        "timestamp": "2018-03-26T10:26:06.983Z",
        "title": "Monday test 1 "
    }
}

最佳答案

尝试 Map<String, Object>解析json。字符串是这里的变量键。 对象是您的“PDF”、“URL”的 POJO, “图像”, “简短的介绍”, “时间戳”, "title": "测试"

关于android - 在改造android中解析嵌套的json对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49809760/

相关文章:

java - 如何在 fragment 内创建自定义 ListView

javascript - 将包含数组的对象插入返回 JSON

java - 在 Android 中寻找 JSONObject 的最快方式字符串

javascript - 解码从ajax返回的javascript中的json对象

android - 在 build.gradle 中使用 XML 到 java 对象转换器依赖项构建错误以进行改造

java - 如何从android中的嵌套对象访问setter?

android - 如何将 ArrayAdapter.getView() 中的 'position' 参数转换为基础数据的绝对索引?

android - 何时使用约束布局以及如何有效地使用它?

android - 可穿戴数据层 API : Can't find setUrgent() method in putDataMapRequest

java - ORMLite 数据库模型通过改造适配器转为 GSON 错误; java.lang.IllegalStateException