开发者

how can i parse "GlossSeeAlso": ["GML", "XML"] in android by using JSON

开发者_StackOverflow社区
"GlossDef": 
   {
         "para": "A meta-markup language, used to create markup languages such asDocBook.",
    "GlossSeeAlso": ["GML", "XML"]
  }

here i parsed para. Its value came.

But how can i parse "GlossSeeAlso": ["GML", "XML"].

please help me....


If you are always expecting an array there then use the method .getArray - see: http://developer.android.com/reference/org/json/JSONObject.html#getJSONArray%28java.lang.String%29


JSONObject jObject=new JSONObject(jString);
JSONObject glossDefObject = jObject.getJSONObject("GlossDef");
String para = glossDefObject.getString("para");
System.out.println(para);
JSONArray GlossSeeAlso =glossDefObject.getJSONArray("GlossSeeAlso");
System.out.println(GlossSeeAlso);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜