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 

> 
> composer require jms/serializer-bundle 
> 
> 
> 

and when i try to use it this way :

```
``` demands = $demandRepo->findAll();
    return $this->container->get('serializer')->serialize($demands,'json');```

```

it gives me this errur : 

`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.`