i have a rest api response in the below format
[ { "Male": "N" } ]
I need to extract the value of Male - which is N ; When i run the below code
code
public void abc() throws ClientProtocolException, IOException, JSONException
{
JSONObject response = Services.getHTTPRequest(dataTable);
JSONArray jsonarray = new JSONArray(response);
for (int i = 0; i < jsonarray.length(); i++) {
response = jsonarray.getJSONObject(i);
String flag = response.getString("Eligible Flag");
System.out.println(flag);
}
i get below error saying : 1. org.json.JSONException: A JSONObject text must begin with '{' 2. print statement is printing the whole response. i Need just the value of Male which is N