I have output from url as following:
["HANK-TPSSL4-app","acgeneral-app","acgeneral-web","achalf-app","acproduct-app"]
My Java code to get each object from this array:
BufferedReader in = new BufferedReader(new InputStreamReader((HttpURLConnection) alertHandleUrl.openConnection().getInputStream()));
String output;
while ((output = in.readLine()) != null) {
JSONArray array = new JSONArray(output);
for (int i =0; i < array.length(); i++)
JSONObject row = array.getJSONObject(i);
System.out.println(row);
}
The error I am getting is
Exception in thread "main" org.json.JSONException: JSONArray[0] is not a JSONObject. at org.json.JSONArray.getJSONObject(JSONArray.java:330) at com.ebay.sherlock.calc.AutoConfigFunc.main(AutoConfigFunc.java:70)
Can someone help me? Thanks in advance