JSON数组逻辑问题

时间:2011-02-01 16:06:40

标签: java android json

HY!

JSON:

{
   "responseData":{
      "countries":[
         {
            "name":"\u00d6sterreich",
            "id":"1",
            "channels":[
               {
                  "name":"ARD",
                  "id":"3"
               },
               {
                  "name":"ORF 1",
                  "id":"1"
               },
               {
                  "name":"ORF 2",
                  "id":"2"
               }
            ]
         },
         {
            "name":"Deutschland",
            "id":"2",
            "channels":[
               {
                  "name":"ARD",
                  "id":"3"
               }
            ]
         }
      ]
   },
   "responseDetails":null,
   "responseStatus":200
}

Java代码:

JsonObject obj = new JSONParse(text);
JSONObject menuobj = this.getJSONObject("responseData");

如何使用国家/地区访问阵列?

THX

1 个答案:

答案 0 :(得分:0)

这个怎么样:

JSONArray countries = menuObj.getJSONArray("countries");