看下面
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"customMetaTags": [
{
"metatag": "#TAPE"
}
],
"geoPolitical": [
{
"gp_code": "Default / All GPIDs"
}
],
"entity": [],
"topics": [
{
"topic_code": "#CAR"
},
{
"topic_code": "#CAREER"
},
{
"topic_code": "#CAREERS"
},
{
"topic_code": "#CARE"
}
]
}
]
}
答案 0 :(得分:0)
请尝试这个
try {
ArrayList<String> topicsList = new ArrayList<>();
JSONObject jsonObject = new JSONObject(resultJSON);
JSONArray result = jsonObject.getJSONArray("results");
for(int i=0;i<result.length();i++) {
JSONObject jsonObject1 = result.getJSONObject(i);
JSONArray topics = jsonObject1.getJSONArray("topics");
for(int j=0;j<topics.length();j++) {
JSONObject jsonObject11 = topics.getJSONObject(j);
topicsList.add(jsonObject11.getString("topic_code"));
}
}
} catch (JSONException e) {
e.printStackTrace();
}