JSONObject
has an available constructor JSONObject(String s)
available, but eclipse is telling me it is undefined.
My code is as following:
URL url = new URL("https://ajax.googleapis.com/ajax/services/search/images?" +"v=1.0&q=barack%20obama&userip=INSERT-USER-IP");
URLConnection connection = url.openConnection();
connection.addRequestProperty("Referer", "http://google.com");
String line;
StringBuilder builder = new StringBuilder();
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
while((line = reader.readLine()) != null) {
builder.append(line);
}
JSONObject json = new JSONObject(builder.toString()); //Error, undefined
I have triple checked that all my libraries are the latest and most stable, as well as implemented properly(apart of my build path).