static function json( $data, $code = 200 ) {
        return (new Response())
            ->setCode($code)
            ->setContent(json_encode($data))
            ->setContentType('application/json');
    }
static function json( $data, $code = 200 ) {
        return (new Response())
            ->setCode($code)
            ->setContent(json_encode($data))
            ->setContentType('application/json');
    }
static function json ( $ data , $ code = 200 ) { return ( new Response ( ) ) -> setCode ( $ code ) -> setContent ( json_encode ( $ data ) ) -> setContentType ( 'application/json' ) ; }
Create Response object with JSON header + content

@param array $data
@param int $code HTTP code (optional)
@return Response object
Create Response object with JSON header + content