src/IO/ResponseJson.php
public function formatResponseBad($response) {
        //$utf8Response = $this->utf8Encode($response);
        $returnResponse = array('success'=>false, 'responseData'=>$response);
        $this->sendHeaders('Content-Type: application/json');
        echo json_encode($returnResponse);
        return json_encode($returnResponse);
    }
public function formatResponseBad($response) {
        //$utf8Response = $this->utf8Encode($response);
        $returnResponse = array('success'=>false, 'responseData'=>$response);
        $this->sendHeaders('Content-Type: application/json');
        echo json_encode($returnResponse);
        return json_encode($returnResponse);
    }
It gets the return array and it encapsulates into the json_encode. The
right way of json structure is, array(success=>1|0 responseData=>
result of the controller action or error message). The return data will be
encode into the utf8.

@param mixed $response
@return string