Я добавил следующее в свой POM-файл в IntelliJ (я использую Maven)
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
Но для моего кода я получаю ошибку Cannot Resolve Symbol при создании объекта "JSONArray".
Я пытался использовать import org.json.jsonarray и import org.json.simple.jsonarray
Я вышел из IntelliJ и перестроил проект.Я не понимаю, что я делаю неправильно.
public class Countries {
private static String url;
private static int count;
private static int sCode;
private static List<CountriesData> cList;
public void GetCountries() throws Exception
{
try {
url = "http://restcountries.eu/rest/v1/all";
// make get request to fetch json response from restcountries
Response resp = get(url);
//Fetching response in JSON as a string then convert to JSON Array
JSONArray jsonResponse = new JSONArray(resp.asString());