简体   繁体   中英

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....

如果您一直期望在那里使用数组,请使用.getArray方法-请参阅: 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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM