I need help parsing json data to a specific format so I can put it on a line chart. More specifically a line graph using highcharts This data comes from a query
$data['graph']=$this->mymodal->graphmodal($id);
foreach ($data['graph'] as $row)
{
//modify array..
}
echo json_encode($data['graph']);
The result this produces is the following
[
{
Name: "Dr Pepper",
January: 4,
February: 5
},
{
Name: "Coke",
January: 2,
February: 4,
},
...
...
I would like my json format to look something like this
[
{
Name: 'Dr Pepper',
data: [4,5]
},
{
Name: 'Coke',
data: [2,4]
}
]
Is this possible to do and how so?