protected function json($data=[], $bodyFormat=null, $statusCode=null, $message=null)
    {
        // Check default Body Format setting if not assigning
        $bodyFormat = ($bodyFormat!==null) ? $bodyFormat : $this->bodyFormat;
        
        if ($bodyFormat) {
            // Pack data
            $data = $this->_format($statusCode, $message, $data);
        } else {
            // JSON standard of RFC4627
            $data = is_array($data) ? $data : [$data];
        }

        return $this->response->json($data, $statusCode);
    }
protected function json($data=[], $bodyFormat=null, $statusCode=null, $message=null)
    {
        // Check default Body Format setting if not assigning
        $bodyFormat = ($bodyFormat!==null) ? $bodyFormat : $this->bodyFormat;
        
        if ($bodyFormat) {
            // Pack data
            $data = $this->_format($statusCode, $message, $data);
        } else {
            // JSON standard of RFC4627
            $data = is_array($data) ? $data : [$data];
        }

        return $this->response->json($data, $statusCode);
    }
protected function json ( $ data = [ ] , $ bodyFormat = null , $ statusCode = null , $ message = null ) { // Check default Body Format setting if not assigning $ bodyFormat = ( $ bodyFormat !== null ) ? $ bodyFormat : $ this -> bodyFormat ; if ( $ bodyFormat ) { // Pack data $ data = $ this -> _format ( $ statusCode , $ message , $ data ) ; } else { // JSON standard of RFC4627 $ data = is_array ( $ data ) ? $ data : [ $ data ] ; } return $ this -> response -> json ( $ data , $ statusCode ) ; }
Output by JSON format with optinal body format

@deprecated 1.3.0
@param array|mixed Callback data body, false will remove body key
@param bool Enable body format
@param int HTTP Status Code
@param string Callback message
@return string Response body data

@example
json(false, true, 401, 'Login Required', 'Unauthorized');
Output by JSON format with optinal body format