php - Json array result in CodeIgniter

one text

Solution:

Your data needs just further processing to return it the way you like

$temp = [];
foreach($invoices as $key1 => $value1) {
    foreach($value1 as $key2 => $value2) {    
        switch($key2) {
            case 'date_issued':
                $temp[$key1][] = strtotime($value2);
            break;
            case 'grand_total':
                $temp[$key1][] = floatval($value2);
            break;
            default:
            break;
        }
    }
}
$response['price'] = $temp;
echo json_encode($response,TRUE);

Source