How to render ZF2 view within JSON response?
So far, I have figured out how to return a typical JSON response in Zend Framework 2. First, I added the
ViewJsonStrategy to the
strategies section of the
view_manager configuration. Then, instead of returning a
ViewModel instance from the controller action, I return a
JsonModel instance with all my variables set.