title: Slim JSON Outputs
body: <p>I am using the Slim framework with PHP to create a RESTful API for my app. However, I assumed that the framework would have some way of creating easier JSON outputs rather than just <code>exit($jsonEncodedVariable);</code>. </p>
  
  <p>Am I missing something in the framework, or do I need to use <code>json_encode()</code>... <code>exit($json)</code>... for every method?</p>
  
  <p>All of the data is taken out of the my MySQL database and would then be put into a JSON array depending on what REST request was called. </p>
  
  <p>For example, if <code>/api/posts/all</code> was requested, I would <code>exit()</code> a JSON array of all the posts which each value for its own key, <code>"value" : key</code>. </p>
  
  <p>My question is, is there an easy way, using the slim framework, for <code>exit()</code>'ing JSON code instead of exiting it as plain text?</p>