0

我正在尝试获取具有 2 个具有相同名称但具有不同值的列表对象的 JSON 对象。名为“items”的对象列表,第一个“items”有“products_title,product_image,link”,第二个“items”有“article_title,article_image,link”。如何编写 PODO ?

我一直在尝试编写 PODO,但即使我尝试更改模型,它仍然无法正常工作。我尝试了其他 REST API,例如“ https://jsonplaceholder.typicode.com/pothos ”它工作正常。但是如果我尝试使用我的 JSON 会出错,我想知道如何编写 PODO ?

这是我正在使用的 JSON:

{
"data": [
    {
        "section": "electronics",
        "items": [
            {
                "product_name": "Cellphone",
                "product_image": "cellphoneImage.png",
                "link": "https://cellphone.html"
            },
        ]
    },
    {
        "section": "facts",
        "section_title": "Title section",
        "items": [
            {
                "article_title": "Facts",
                "article_image": "https://www.facts.png",
                "link": "https://www.facts.html"
            },
        ]
    }
]

}

4

0 回答 0