private function jsonResponse($data)
    {
        $response = new Response(json_encode($data));
        $response->headers->set('Content-Type', 'application/json');
        return $response;
    }
private function jsonResponse($data)
    {
        $response = new Response(json_encode($data));
        $response->headers->set('Content-Type', 'application/json');
        return $response;
    }
private function jsonResponse ( $ data ) { $ response = new Response ( json_encode ( $ data ) ) ; $ response -> headers -> set ( 'Content-Type' , 'application/json' ) ; return $ response ; }
Return a JSON response

@param void $data
@return \Symfony\Component\HttpFoundation\Response
Return a JSON response