I want to decode json string in Php that is pass from android.
Suppose i have follwing json that comes from android
{"name":"ajay"} and in php i do
<?php
$result=json_decode('$_POST',true);
$name=$result['name'];
$response=array();
$response["message"]=$name successfully parse in php;
echo json_encode($response);
?>
This gives html tag in response.Is there is any way to solve this?
Follow this link. Maybe this will be helpful:
This seems working fine for me
<?php
$result=json_decode('{"name":"ajay"} ',true);
$name=$result['name'];
$response=array();
$response["message"]="$name successfully parse in php";
echo json_encode($response);
?>
Check php manual for json_decode for more