title: How to use JMSSerializer with symfony 4.2
body: <p>i am building an Api with symfony 4.2 and want to use jms-serializer to serialize my data in Json format, after installing it with </p>
  
  <blockquote>
    <p>composer require jms/serializer-bundle </p>
  </blockquote>
  
  <p>and when i try to use it this way :</p>
  
  <pre><code>``` demands = $demandRepo-&gt;findAll();
      return $this-&gt;container-&gt;get('serializer')-&gt;serialize($demands,'json');```
  </code></pre>
  
  <p>it gives me this errur : </p>
  
  <p><code>Service "serializer" not found, the container inside "App\Controller\DemandController" is a smaller service locator that only knows about the "doctrine", "http_kernel", "parameter_bag", "request_stack", "router" and "session" services. Try using dependency injection instead.</code></p>