protected function _ensureSerialize()
    {
        $controller = $this->_controller();

        if (isset($controller->viewVars['_serialize'])) {
            return;
        }

        $serialize = [];
        $serialize[] = 'success';

        $action = $this->_action();
        if (method_exists($action, 'viewVar')) {
            $serialize['data'] = $action->viewVar();
        } else {
            $serialize[] = 'data';
        }

        $serialize = array_merge($serialize, (array)$action->getConfig('serialize'));
        $controller->set('_serialize', $serialize);
    }