I am using the Zend Framework helper for JSON.
I am returning an array of data from a domain entity using a created method toArray().
Is there a way to change the format from tidy to pretty?
PHP
$data = array(
"success"=>true,
"user"=>array($user->toArray())
);
$this->_helper->json($data);
Body Response:
{"success":true,"user":[{"id":9,"displayName":"joey","firstName":"joe","lastName":"blow","email":"joeblow@yahoo.com","role":"user"}]}
To:
{
"success":true,
"user": [{
"id":9,
"displayName":"joey",
"firstName":"joe",
"lastName":"blow",
"email":"joeblow@yahoo.com",
"role":"user"
}]
}
It’s not tested and would depend on some of your json implementation but you could try :