true|false * this array can contains a 'keepLayout'=>true|false * that will not be passed to Zend_Json::encode method but will be used here * @return string|void */ public function json($data, $keepLayouts = false) { $options = array(); if (is_array($keepLayouts)) { $options = $keepLayouts; $keepLayouts = (array_key_exists('keepLayouts', $keepLayouts)) ? $keepLayouts['keepLayouts'] : false; unset($options['keepLayouts']); } $data = Zend_Json::encode($data, null, $options); if (!$keepLayouts) { require_once 'Zend/Layout.php'; $layout = Zend_Layout::getMvcInstance(); if ($layout instanceof Zend_Layout) { $layout->disableLayout(); } } $response = Zend_Controller_Front::getInstance()->getResponse(); $response->setHeader('Content-Type', 'application/json', true); return $data; } }