CodeIgniter Echo Set Content Type

public function jsonExit($array)
{
    $this->con->output->set_content_type('application/json'); // $this->con is get_instance from the constructor
    $this->con->output->set_output(json_encode($array));
}