Countries take from here:

https://api.vk.com/api.php?oauth=1&method=database.getCountries&v=5.6&need_all=0&count=1000

{"response": {"count":18, "items": [{"id":1,"title":"Россия"}] } } 

how to parse items items ?

1 answer 1

The items array can be obtained as follows:

 JSONObject response = new JSONObject(jsonStr).getJSONObject("response"); JSONArray items = response.getJSONArray("items"); 

where jsonStr is your JSON.

Then you can get a list of countries:

 List<String> countriesArrayList = new ArrayList<>(items.length()); for (int i=0; i<items.length(); i++) { countriesArrayList.add(items.getJSONObject(i).getString("title")); }