I am using cakephp 2.x and returning some json data using the following; I would like to remove the model name User from the results so only the key and value is returned.
$this->set('_serialize', 'json');
and my results are returned in the following format;
[
{
"User": {
"fullname": "John Smith"
}
},
{
"User": {
"fullname": "Jiles Smith"
}
}
}
]
I am tried the following;
$json = json_encode(Set::extract('/User/.', $json));
but its returned like;
"[{\"fullname\":\"Ashley Smith\"},{\"fullname\":\"Leigh Smith\"},{\"fullname\":\"Charlie Chocolate\"}]"