I’m using the serialize key to output data in json format. Is there a way to output nothing, just an empty response with application/json as content-type? I’ve tried null, an empty string and an empty array as a serialize value but nothing seems to do the trick.
Reference: http://book.cakephp.org/2.0/en/views/json-and-xml-views.html#using-data-views-with-the-serialize-key
You’d have to not use the _serialize method and instead use a custom view. See: http://book.cakephp.org/2.0/en/views/json-and-xml-views.html#using-a-data-view-with-view-files
You can make all your actions use the same view file via
$this->render('my_custom_view');instead of creating a new view file for each.