title: WP REST API returns HTML instead of JSON
body: <p>An endpoint of <code>https://example.com/wp-json/wp/v2/pages/123</code> returns a combination of HTML and JSON format such as:</p>
  
  <pre><code>&lt;div class="my-class"&gt;HTML Content&lt;/div&gt;
  { "id" : 123, ... }
  </code></pre>
  
  <p>There is an excerpt filter in <code>functions.php</code> that set the outputted HTML, in this line:</p>
  
  <pre class="lang-php prettyprint-override"><code>function my_custom_filter(){
    echo '&lt;div class="my-class"&gt;HTML Content&lt;/div&gt;';
  }
  add_filter ('the_excerpt', 'my_custom_filter' );
  </code></pre>
  
  <p>How to prevent such filter from intervening with the JSON response?</p>