【发布时间】:2023-03-05 14:08:01
【问题描述】:
我有一些仅包含对象的示例 json 数据。
{
"0": {
"image": null,
"title": "Government to issue new ₹500 and ₹2,000 notes from Nov 10 ",
"time": "10:46 pm ",
"date": "08 Nov ",
"content": "The government will start issuing the new ₹500 and ₹2,000 currency notes from November 10, said ...",
"link": "https://full-story.newsinshorts.com/v1/article/f0619b6a-738e-4470-897f-4e5cdad3ea52-1 "
},
"1": {
"image": null,
"title": "₹1,000, ₹5,000 and ₹10,000 notes were demonetised in 1978 ",
"time": "10:20 pm ",
"date": "08 Nov ",
"content": "The Indian government had demonetised the ₹1,000, ₹5,000 and ₹10,000 currency notes in 1978 ...",
"link": null
},
...
}
它的对象比可见的要多。如何继续解析这些数据?
【问题讨论】:
-
你可以试试this sample,我看到它几乎和你的json一样。
-
你为什么尝试使用 GSON 将其解析为模型类并使用该模型
-
@Saveen - 你如何创建一个名为
0的对象? -
@Cricket_007 先生,这个 json 不正确,需要 json 数组