title: Laravel 4 JSON Output formatting
body: <pre><code>return Response::json(array(
      'status' =&gt; 200,
      'posts' =&gt; $post-&gt;toArray()
  ), 200);
  </code></pre>
  
  <p>Using the code above I returned data in json format.<br>
  I have seen other api's that return json giving it back in formatted view.<br>
  Like:  </p>
  
  <pre><code>http://api.steampowered.com/ISteamNews/GetNewsForApp/v0002/?appid=440&amp;count=3&amp;maxlength=300&amp;format=json
  </code></pre>
  
  <p>But mine is returning it in one line. How do I generate the json in a formatted way with laravel?</p>
  
  <hr>
  
  <p><strong>update</strong></p>
  
  <p>I cannot test the code yet until I tomorrow. So I'll accept the answer tom.</p>
  
  <p>But this is the api</p>
  
  <pre><code>http://laravel.com/api/class-Illuminate.Support.Facades.Response.html
  </code></pre>
  
  <p>and the parameters are,</p>
  
  <pre><code>$data
  $status
  $headers
  </code></pre>
  
  <hr>
  
  <p><strong>update</strong></p>
  
  <p>Actually I modified the response class of illuminate to have that constant.</p>