Android Studio - Download JSON from url

I understand this probably isn’t really related to the content of this website but I am making an app on Android and really need some help. It is a puzzle app where all the content is downloaded from URL’s and stored onto the device. or puzzle2.json or puzzle3.json…etc

Contains: {image: “hotel”, layout: “layout.json”}

Image contains partial images for the puzzle

layout contains array for rows and columns where above images will be placed

My question is what would be the best way to download all this content without doing every URL individually, as there is at least 100 puzzles? I can download one of the objects easily but can’t get my head around how to get them all in one go

Do you have a list of all the puzzle names? If so, put them in an array and iterate through the array to make the call each time.

If the puzzle names actually end in 1, 2, 3, 4, etc… then you could create a for loop with a variable (i.e. index) starting at 1 and ending at the last puzzle number. Inside the for loop, you would concatenate “puzzle” + index + “.json” and make the call using this concatenated string.

yeah I do, its in the index of the url so www.exampleUrl/index.json. this contains a JSON array of all the puzzles. thank you for the suggestion I was thinking the same thing, I am just new to Android and not sure how to implement it properly