title: Laravel array to json format
body: <p>So I'm trying to convert a Laravel array into <code>json</code> so I can then manipulate it through javascript. Im not sure how this is achieved correctly. Here is the code, so far</p>
  
  <pre><code>@foreach ($posts as $post)
  &lt;div class="row"&gt;
     &lt;div class="col-md-8"&gt;
       &lt;div class="row"&gt;
          &lt;div class="col-md-8 tag"&gt;
              &lt;h4&gt;&lt;strong&gt;&lt;a href="{{{ $post&gt;postName }}}"&gt;#{{String::title($posts-&gt;postName) }}&lt;/a&gt;&lt;/strong&gt;&lt;/h4&gt;
          &lt;/div&gt;
       &lt;/div&gt;
      &lt;!-- ./ post title --&gt;
     &lt;/div&gt;    
  &lt;/div&gt;
  &lt;hr /&gt;
  @endforeach
  
  
  &lt;script type="text/javascript"&gt;
     var data = "{{ ($posts) }}"; // ??
     console.log(data);
  &lt;/script&gt;
  </code></pre>