I generate the data using php script and it shows a json data, I have my android app that parse that data. When i open that link it doesn't parse that data. but when I copy the script generated output to a file with .json extension than my app is able to parse the data. Sorry for my English. And thanks in advance. I am newbie to json. Here is my php code which generate json data.
$jsonresponse = array("members"=>array());
while($row=mysql_fetch_array($result))
{
$row['firstname'] = ucfirst(strtolower($row['firstname']));
$row['surname'] = ucfirst(strtolower($row['surname']));
$id = $row['id'];
$name = $row['firstname']." ".$row['surname'];
$city = $row['city'];
$jsonrow = array(
"id"=>$id,
"name"=>$name,
"city"=>$city
);
array_push($jsonresponse["members"],$jsonrow);
}
echo json_encode($jsonresponse);
Output
{"members":[{"id":"1","name":"Sarvagna Mehta","city":"Ahmedabad"}]}
No, need to change anything in android code. Just solved my problem.