-3

I want to read this JSON lines but because it start with JSONArray i'm a little confused

JSON : https://pastebin.com/zbGXVLJv

I want to retrieve the contents of "img_src"

Kotlin:

 val jsonArrayRequest = JsonArrayRequest(url, Response.Listener(){
        var data = (JSONArray("photos"))

        for (itIndex in 0 until data.length()) {

            val item = data.getJSONObject(itIndex)
            val imgSrc = item.getString("img_src")

             _PhotoList.add(PhotosHubble(imgSrc))

        }
Wizeep
  • 49
  • 7

1 Answers1

0

Please use Generate POJO from JSON tool of Android Studio and generate different data class then use that data classes to pass in API calling

Jaimil Patel
  • 1,301
  • 6
  • 13