package com.example.helloworld; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; public class MyTest { public static void main(String[] args) throws JSONException { String str = "{'league': 'Champions League','season': '2015/16','start': '2015-11-01','end': '2016-03-31','teams': [ \r\n { 'name': 'Spain' },\r\n { 'name': 'Germany'},\r\n { 'name': 'Italy' },\r\n { 'name': 'Brasil' },\r\n { 'name': 'Argentina' }\r\n]}"; System.out.println(getCountyList(str).toString()); } public static List<String> getCountyList(String json) throws JSONException { List<String> list = new ArrayList<String>(); JSONObject jsonObject = new JSONObject(json); JSONArray teamList = (JSONArray) jsonObject.get("teams"); for (int i = 0, len = teamList.length(); i < len; i++) { JSONObject team = (JSONObject) teamList.get(i); list.add((String) team.get("name")); } return list; } }