It' easy to get a value from JSON when you have the string key, but what if you have situation like that:
{
"images":["URL1"]
}
And array and no key inside? I use this code:
JSONArray imagesArr = propertiesjsonObject.getJSONArray("images");
for (int y=0; i<imagesArr.length(); y++)
{
JSONObject imagesJsonObject = imagesArr.getJSONObject(y);
String str_image_url = imagesJsonObject.get("HOW TO GET THE VALUES HERE?");
}
Propably it's ultra easy. Sorry to ask but I could not find proper example. PS. I use: import org.json.JSONArray; import org.json.JSONObject;
PS2: For now there is only one element in array, but in future I suppouse there might be more.