I'm bringing json_encode data from the db.
foreach ($rslt as $val){
$data[] = $val;
}
echo json_encode($data);
the output is [{"column name":"dbData1"},{"column name":"dbData2"}]
Instead of the column name can I replace it to a custom name?
expected output:
[{"rec":"dbData1"},{"rec":"dbData2"}]
[ "newkey" => $val["oldkey"] ]