我刚开始在Java中使用json。我不确定如何访问JSONArray中的字符串值。例如,我的json看起来像这样:
"media": {
"images": [
"https://newstaging-api.safegold.com"
],
"videos": [
"https://newstaging-api.safegold.com"
]
}
现在,我想获取“ images”的值。实际上,我想从URL在ImageView中显示图像。在此先感谢
JSONObject json = new JSONObject(json_data); //json_data - your json string
JSONObject media = json.getJSONObject("media");
JSONArray images = media.getJSONArray("images");
String link = images.getString(0);```