Hi,
I'm trying to send a array of objects from PHP to jqChart using JSON.
$data = array();
foreach ($kpis_values as $time => $value) {
$object = new stdClass();
$object->dateTime = $time;
$object->value = $value;
$data[]=$object;
}
$response->dataSource=$data;
return json_encode($response, JSON_FORCE_OBJECT);
...
After passing to JavaScript I get this:
{
"0":{"dateTime":"2014-05-15","value":"99.851"},
"1":{"dateTime":"2014-05-16","value":"99.830"},
"2":{"dateTime":"2014-05-17","value":"99.784"}
}
not exactly what jqChart needs;
[
{"date":"12/20/2012","value":30},
{"date":"12/21/2012","value":50},
{"date":"12/22/2012","value":45}
]
Could anyone help me?
Thanks