my php code for making a json array so far is
$response[$x]=$row['firstname']." ".$row['lastname'];
$res2=array("names"=>$response);
echo json_encode($res2);
where response is an array. This has as output
{"names":["Mario 1","Luigi 2","Mario 3"]}
which looks like a json array but when i try to retrieve the array in android by using
json.getJSONArray("names");
I get a jsonexception saying "no values for names". What is wrong? Otherwise any suggestion on how to put the names on a jsonobject and retrive them in android.?