protected function returnJson($data, $httpStatus = 200)
    {
        header(HTTPToolkit::statusCodeHeader($httpStatus));
        Context::getInstance()->getResponse()->setContentHeader('application/json');
        $this->response = $this->getPsrResponse()->withBody(stream_for(json_encode($data)));
    }
protected function returnJson($data, $httpStatus = 200)
    {
        header(HTTPToolkit::statusCodeHeader($httpStatus));
        Context::getInstance()->getResponse()->setContentHeader('application/json');
        $this->response = $this->getPsrResponse()->withBody(stream_for(json_encode($data)));
    }
protected function returnJson ( $ data , $ httpStatus = 200 ) { header ( HTTPToolkit :: statusCodeHeader ( $ httpStatus ) ) ; Context :: getInstance ( ) -> getResponse ( ) -> setContentHeader ( 'application/json' ) ; $ this -> response = $ this -> getPsrResponse ( ) -> withBody ( stream_for ( json_encode ( $ data ) ) ) ; }
Return json response.

@param array|\JsonSerializable $data
@param int $httpStatus
Return json response .