Skip to content

Instantly share code, notes, and snippets.

@markguinn
Created August 5, 2015 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markguinn/d6ce3c33eacacef534bb to your computer and use it in GitHub Desktop.
Save markguinn/d6ce3c33eacacef534bb to your computer and use it in GitHub Desktop.
/**
* @param array $data
* @return SS_HTTPResponse
*/
protected function returnJson(array $data) {
$response = $this->getController()->getResponse();
$response->addHeader('Content-type', 'application/json');
$response->setBody(json_encode($data));
return $response;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment