title: How show json data with database in symfony
body: <p>I have a little problem, because I have to show json date with database in Symfony3.</p>
  
  <p>My controller </p>
  
  <pre><code>/**
       * @Route("/api/rest", name="rest_api")
       * 
       * 
       * @Template
       */
  public function indexAction(Request $Request) {
  
      $Repo = $this-&gt;getDoctrine()-&gt;getRepository('CommonUserBundle:Comment');
      $row = $Repo-&gt;findAll();
  
  
      $data = json_encode($row, true);
  
      return array(
          'comment' =&gt; $data
      );
  }
  </code></pre>
  
  <p>And this is my layout in html.twig</p>
  
  <pre><code>{% for comments in comment %}
             {{ comments }}
  {% endfor %}
  </code></pre>
  
  <p>But I don't know why nothing show.
  Help me please :)</p>