C
C
Cat Anton2014-11-02 13:46:07
Zend Framework
Cat Anton, 2014-11-02 13:46:07

How to set JSON_UNESCAPED_UNICODE in JsonModel?

How can I prevent escaping unicode characters in the JsonModel so that it doesn't get \uXXXX in the output?

namespace Application\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\JsonModel;

class AjaxController extends AbstractActionController
{
    public function indexAction()
    {
        $json = new JsonModel(array(
            'html' => 'тест'
        ));

        return $json;
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
neolink, 2014-11-02
@27cm

https://github.com/zendframework/zf2/blob/master/l...
https://github.com/zendframework/zf2/blob/master/l...
So just make your own JsonModel.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question