2011-02-01 110 views
0

Hy!JSON陣列邏輯問題

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

在發佈JSON,你可能想使用進行格式化: http://jsonformatter.curiousconcept.com/ – 2011-02-01 16:08:15

回答

0

這個怎麼樣:

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