title: Converting URL to JSON version?
body: <p>On all the pages of my app, I want a link to the JSON version of current page. Any neat tricks to do this? Where it got complicated was when additional '&amp;' parameters were included in the URL.</p>
  
  <p>So the urls would be transposed as:</p>
  
  <pre><code>'/users' =&gt; '/users.json'
  
  '/users?page=1&amp;per_page=5' =&gt; '/users.json?page=1&amp;per_page=5'
  </code></pre>