My Output must be like this
[
{"Airtel":{"v": 50.00}},
{"Hutch":{"v": 10.00}},
{"Idea":{"v": 10.00}},
{"TATA":{"v": 10.00}},
{"Vodafone":{"v": 20.00}},
{"Aircel":{"v": 15.00}}
]
Im using the data from Mysql so I cant put the data directly in the Code(Php). . . Im using the below code to get a data from the datbase
<?php
$con=mysql_connect("localhost","root","") or die("Failed to connect with database!!!!");
mysql_select_db("chart", $con);
$sql=mysql_query("select * from googlechart");
$response = array();
$posts = array();
$i=0;
while($row=mysql_fetch_array($sql)) {
$response[$i]['url'] = $row['weekly_task'];
$response[$i]['title']= $row['percentage'];
$data['posts'][$i] = $response[$i]; echo "\n";
$i=$i+1;
}
$json_string = json_encode($data);
$file = 'json.aspx';
file_put_contents($file, $json_string);
?>