I have a python script get_telemetry.py
that results in this data:
voltage = [[14.766786195683332, u'2017-10-11T06:00:00Z'], [14.756422268006672, u'2017-10-11T07:00:00Z'], [14.213013911141665, u'2017-10-11T08:00:00Z']]
I am trying to send this data to a php script where it will be converted into a php array, that will eventually end up in a google chart:
$voltagedata = ["2017-10-11 06:00:00" => 14.76, "2017-10-11 07:00:00"=> 14.75, "2017-10-11 08:00:00" => 14.21]
But when I try to encode the python list into json:
print json.dumps(voltage)
and then try decode it in php:
$result = shell_exec('get_telemetry.py ' . $imei);
$voltagedata = json_decode($result, true)
I get this error:
Notice: Array to string conversion
How can I get that python list of lists into a php array? I've tried to pass the python list into a dictionary first, but this gives me the same result. ie : from this example