-2

I'm just getting started with using json with java. I'm not sure how to access string values within a JSONArray. For instance, my json looks like this:

 "media": {
            "images": [
                "https://newstaging-api.safegold.com"
            ],
            "videos": [
                "https://newstaging-api.safegold.com"
            ]
        }

Now I want to get the value of "images".Actually I want show image in ImageView from URL. Thanks in advance

Afroz Ahmad
  • 69
  • 10

1 Answers1

-2
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);```
Alex Maddyson
  • 411
  • 4
  • 13