You are trying to convert the String response received from the server to a JSONObject that throws an exception. As you said, you will get JSONArray from the server, you will try to convert it to JSONArray . See the JSONObject help you convert the response of a JSONObject and JSONArray . If your answer starts with [(Open Square Bracket), then convert it to JsonArray, as shown below
JSONArray ja = new JSONArray(jsonResponse);
if your answer starts with {(open flower Bracket), then convert it to
JSONObject jo = new JSONObject(jsonResponse);
TNR
source share