Reputation: 537
I have added the following in my POM file within IntelliJ (I'm using Maven)
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
But for my code I am getting Cannot Resolve Symbol error when creating a "JSONArray" object.
I have tried using import org.json.jsonarray and import org.json.simple.jsonarray
I have exited IntelliJ and rebuilt the project. I don't see what I am doing wrong.
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());
Upvotes: 1
Views: 12541