有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何解析复杂的JSON并使用改进将其放入列表

我有如下所示的JSON

{
"status" : "succesfull",
"items": [
    {
        "id" : "1",
        "name": "apple",
        "counrty": "USA"
    },
    {
        "id": "2",
        "name": "banana",
        "country": "Jamaica"
    },
    {
        "id":"3",
        "name": "potatoes",
        "counrty": "Belarus"
    },
    ...
   ]
  }

Let's say, country is varied, and I don't know which countries will be in list

我需要列一个清单如下:

enter image description here

Any solutions will be appreciated

public class Response {
  String status;
  ArrayList<Items> items;      
}



public class Items{
   String id;
   String name;
   String country;
}

共 (0) 个答案