title: problem with converting a entity to json using jms_serializer - Symfony 4
body: <p>i'm trying to make an api to return a json with symfony 4 
  i create a entity and it's work fine but it do not convert data for database to json 
  so the Serializer from "Symfony\Component\Serializer\Serializer" give me error </p>
  
  <pre><code> serialization for the format json is not supported
  </code></pre>
  
  <p>so i tried the Jms_Serializer but in the official website they work with a old version of symfony 
  i installed the bundle with </p>
  
  <pre><code>composer require jms/serializer-bundle   
  </code></pre>
  
  <p>this the code in controller</p>
  
  <pre><code>class ProduitsController extends AbstractController
      {
          /**
           * @Route("/api/produits/cuisine")
           */
          public function index()
          {
              $dc = $this-&gt;getDoctrine();
  
              $Produits=$dc-&gt;getRepository(Article::class)-&gt;findAll();
  
              $data= $this-&gt;get('jms_serializer')-&gt;serialize($Produits,'json');
  
              return new JsonResponse($data);
  
          }
      }
  </code></pre>
  
  <p>i got this error : <code>ServiceNotFoundException</code> </p>
  
  <pre><code>Service "jms_serializer" not found: even though it exists in the app's 
  container, the container inside "App\Controller\ProduitsController" is a
   smaller service locator that only knows about the "doctrine", "form.factory",
   "http_kernel", "parameter_bag", "request_stack", "router", 
  "security.authorization_checker", "security.csrf.token_manager", 
  "security.token_storage", "serializer", "session" and "twig" services. Try
   using dependency injection instead
  </code></pre>
  
  <p>a simple json_encode() to the result 
  give me a empty json</p>