title: How to Initialize JMS Serializer in Symfony3?
body: <p>I am trying to use the <a href="http://jmsyst.com/bundles/JMSSerializerBundle" rel="nofollow">JMSSerializerBundle</a> for Symfony3 (which just came out).</p>
  
  <p>These are the namespaces I've loaded in my <code>TestController.php</code></p>
  
  <p><code>use JMS\Serializer\Serializer;
  use JMS\Serializer\SerializerBuilder;
  use JMS\Serializer\SerializationContext;</code></p>
  
  <p>I've tried <code>$data = $this-&gt;get('jms_serializer')-&gt;serialize($data, 'json');</code> where <code>$data</code> is just a simple object, but get the following error:</p>
  
  <p><code>Attempted to call an undefined method named "get" of class "AppBundle\Controller\TestController"</code></p>
  
  <p>I've also tried a usage example from the site <code>$serializer = $container-&gt;get('jms_serializer');</code>, but get <code>Notice: Undefined variable: container</code></p>
  
  <p>I am still new to Symfony3 and its bundles, and can't seem to find any documention on JMS Serializer for symfony 3</p>
  
  <p>I can initialize it like this <code>$serializer = SerializerBuilder::create()-&gt;build();</code> which allows me to call the <code>serialize</code> method, but I would like to know the correct "symfony way" of doing it.</p>
  
  <p>If anyone can shed some knowledge, that would be great. Thanks!</p>