title: How to disable escaping HTML entities in JSON for API, but leave it enabled for views?
body: <p><code>config.active_support.escape_html_entities_in_json</code> is enabled by deafult in Rails (v4, v5) and it protects from some XSS attacks by encoding HTML entities <code>&lt;</code>, <code>&gt;</code>, <code>&amp;</code> and it's great for views (html)</p>
  
  <p>But I think this encoding is redundant in API responses:</p>
  
  <pre><code>render status: :ok, json: { link: 'https://example.com?p1=v1&amp;p2=v2' }
  </code></pre>
  
  <p>I expect to get:</p>
  
  <pre><code>{ link: 'https://example.com?p1=v1&amp;p2=v2' }
  </code></pre>
  
  <p>instead of </p>
  
  <pre><code>{ link: 'https://example.com?p1=v1\u0026p2=v2' }
  </code></pre>
  
  <p>How to disable escaping HTML entities in JSON for API, but leave it enabled for views?</p>
  
  <p>Thank you</p>