0
我需要在我的json输出中删除双引号,我会多释放它。我得到这个结果:从Json输出中删除引号
[{"id":"1","nom":"Magasin Jardins 2","ville":"Paris","latlng":["36.85715,10.127245"]}
我需要在经纬度我的价值,除去报价要获取经纬度“:
[36.85715,10.127245]
这是我的代码
$qry = "SELECT *FROM magasin";
$result = mysql_query($qry);
// $promotions = array();
$response = array();
while($row = mysql_fetch_assoc($result)) {
// $promotions[]= $row;
$magasin = array();
$magasin["id"] = $row["id"];
$magasin["nom"] = $row["nom"];
$magasin["ville"] = $row["ville"];
$lat = $row[latitude];
$long = $row[longitude];
$magasin["latlng"][] =floatval($lat).",".floatval($long);;
// push single product into final response array
array_push($response, $magasin);
}
mysql_close($con);
echo json_encode($response);
您不删除引号。您可以将该JSON字符串解码为原生数据结构,从而可以直接访问特定元素的值。 –