Php ODBC更改json数组格式

Php ODBC更改json数组格式,php,sql,json,odbc,Php,Sql,Json,Odbc,我正在使用ms access odbc获取sql数据。但是我没有得到我想要的结果。这是我的密码: $rs = odbc_exec($con, $sql); if (!$rs) { exit("There is an error in the SQL!"); } $data[0] = array('D','CPU_Purchased_ghz'); $i = 1; while($row = odbc_fetch_array($rs)) { $data[$i] = $row;

我正在使用ms access odbc获取sql数据。但是我没有得到我想要的结果。这是我的密码:

$rs = odbc_exec($con, $sql);
if (!$rs) {
    exit("There is an error in the SQL!");
}
$data[0] = array('D','CPU_Purchased_ghz');
$i = 1;

while($row = odbc_fetch_array($rs)) {
    $data[$i] = $row;
    $i++;
}

odbc_close($con); // Closes the connection
$json = json_encode($data); // Generates the JSON, saves it in a variable
echo $json;
我获得结果的方式如下:

[
    ["D","CPU_Purchased_ghz"],
    {"D":"2015-03-14 00:00:00","CPU_Purchased_ghz":"10.00"},
    {"D":"2015-03-15 00:00:00","CPU_Purchased_ghz":"10.00"},
    {"D":"2015-03-16 00:00:00","CPU_Purchased_ghz":"10.00"}
];
我希望它看起来像这样:

[
    ["D","CPU_Purchased_ghz"],
    [""2015-03-14 00:00:00",10.00],
    ["2015-03-16 00:00:00",10.00]
]

你知道如何修复/修改我的代码吗?

如果这解决了你的问题,你能接受它作为答案吗?谢谢
while($row = odbc_fetch_array($rs)) {
    $data[$i] = array(
        $row['D'],
        $row['CPU_Purchased_ghz']
    );
    $i++; 
}