我有一个Json Array作为没有名称的字符串,我想解析它如何在android中进行?
我的JsonArray是:
[ { "categoryId":1, "Title":"Rock", "songs":null }, { "categoryId":2, "Title":"Jaz", "songs":null } ]
试试这个..
JSONArray jsonarray = new JSONArray(json); for (int i = 0; i < jsonarray.length(); i++) { JSONObject jsonobj = jsonarray.getJSONObject(i); System.out.println("categoryId : " + i + " = " + jsonobj.getString("categoryId")); System.out.println("Title : " + i + " = " + jsonobj.getString("Title")); System.out.println("songs : " + i + " = " + jsonobj.getString("songs")); }