I'm trying to fetch data and transform this in json to use with High chart.
Here's my code:
$arr = $this->Company->find('all'); // fetch the array
    $arr1 = array();
    foreach ($arr as $value) {
        $tmp = array();
        $tmp['name'] = $value['Company']['nome'];
        $tmp['data'] = '['. count($value['Branch']) .']';
        $arr1[] = $tmp;
        }
    $json = json_encode($arr1);
    $json = preg_replace('/"([^"]+)"\s*:\s*/', '$1:', $json);
    debug($json);
And my atual json:
'[{name:"Sotreq",data:"[11]"},{name:"Somov",data:"[1]"},{name:"Soimpex",data:"[0]"}]'
I've used preg_replaceto remove double quotes of keys. I want to remove double quotes for the data value too.
Pls help?
 
    