title: Grails 2 - produce JSON output automatically (like Spring 3.x does)
body: <p>In Spring MVC 3.x I can configure a <code>ContentNegotiatingViewResolver</code> bean to automatically render any given endpoint in either JSON or XML simply by changing the file extension to <code>.json</code> or <code>.xml</code>. I assumed there was an equivalent functionality in Grails but I can't find it.</p>
  
  <p>Everything I've read says I have to catch the incoming mime-type (using <code>withFormat</code>) and then specify the JSON output using <code>render as JSON</code> (or equivalent) in every one of my controller methods (e.g. <a href="https://stackoverflow.com/questions/4304924/rendering-json-with-grails">rendering JSON with Grails?</a>). Before I dive in and start adding JSON-specific code to my controllers I thought I'd ask here... </p>
  
  <p>So my question is: Can I configure Grails 2 to automatically produce JSON output by simply adding a `.json' file extension (or changing the accept header) for any given URL?</p>