Answer the question
In order to leave comments, you need to log in
Zend Framework 2. How to add hyphens to JSON rendering?
ZF2 renders the page in JSON format, you need to add two characters chr(10) and chr(13) to the end of the JSON string without editing the JsonModel class.
Answer the question
In order to leave comments, you need to log in
Option 1 Set the JsonModel::setJsonpCallback()
callback function Option 2
Write a JsonModel derived class and use it in your application. You will get something like this:
namespace Application\View\Model;
use Zend\View\Model\JsonModel as ZendJsonModel;
class JsonModel extends ZendJsonModel
{
/**
* {@inheritDoc}
*/
public function serialize()
{
return (parent::serialize() . "\r\n");
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question