Setting json response in Phalcon

 $this->view->disable();
 $response->setContentType('application/json', 'UTF-8');
 $this->response->setJsonContent($result);
 $this->response->send();

Alternatively:

$this->view->disable();
header('Content-type:application/json');
echo json_encode($result,JSON_NUMERIC_CHECK);

The first code is the correct way especially if you are using phpdebugbar which will try and echo out its javascript if you use the second non-phalcon version.