how can i parse "GlossSeeAlso": ["GML", "XML"] in android by using JSON
"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);
精彩评论