I'm trying to fatch some data frm database, and trying to create a new json file. However, in my output I'm getting double quotes in the array.
I tried many solutions available on Stack Overflow but no success so far. Help me remove it.
$to=array("name" => "Today","data" => $count1); $yes=array("name" => "Yesterday","data" => $count2); $ab=array($to,$yes); $y=array("format" => "percent"); $z=array("labels" => $ti); $json=json_encode(array("series" => $ab,"y_axis" => $y,"x_axis" => $z)); $fp = fopen('data.json', 'w'); fwrite($fp, $json); fclose($fp); Current output:
{ "series": [ { "name":"Today","data":["123","123","123"] } ], "y_axis": { "format":"percent" }, "x_axis": { "labels": ["00:00","00:00","00:00"] } } I don't need double quotes around 123 & 00:00.
$countXarray. And00:00is not a valid number, so the only way to store that in json, is as a string.