Title: Breaks JSON/REST-API Output
Last modified: March 2, 2017

---

# Breaks JSON/REST-API Output

 *  [ov3rfly](https://wordpress.org/support/users/ov3rfly/)
 * (@ov3rfly)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/breaks-json-api-output/)
 * WP Fastest Cache adds String “<!– html is corrupted –>” to end of JSON/REST-API
   output of WordPress which leads to invalid JSON.
 * Examples:
    - hXXp://www.wpfastestcache.com/wp-json/wp/v2/posts
    - hXXp://www.wpfastestcache.com/wp-json/wp/v2/users
 * Please fix soon, thanks.
    -  This topic was modified 9 years, 3 months ago by [ov3rfly](https://wordpress.org/support/users/ov3rfly/).

Viewing 15 replies - 1 through 15 (of 31 total)

1 [2](https://wordpress.org/support/topic/breaks-json-api-output/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/breaks-json-api-output/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/breaks-json-api-output/page/2/?output_format=md)

 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/breaks-json-api-output/#post-8871978)
 * Please contact me via email: [http://www.wpfastestcache.com/contact-us/](http://www.wpfastestcache.com/contact-us/)
 *  Thread Starter [ov3rfly](https://wordpress.org/support/users/ov3rfly/)
 * (@ov3rfly)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/breaks-json-api-output/#post-8871990)
 * Why exactly? You can see the added `<!– html is corrupted –>` at above example-
   links. These are standard WordPress REST-API links, [more here](https://developer.wordpress.org/rest-api/).
    -  This reply was modified 9 years, 3 months ago by [ov3rfly](https://wordpress.org/support/users/ov3rfly/).
 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/breaks-json-api-output/#post-8872013)
 * because I wanna fix the problem with you.
 *  Thread Starter [ov3rfly](https://wordpress.org/support/users/ov3rfly/)
 * (@ov3rfly)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/breaks-json-api-output/#post-8872033)
 * No further input is necessary, testcases are right there on your server.
 * Spent already enough time on this before I saw that added html-comment…
 * Thanks for quick feedback and the plugin.
 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/breaks-json-api-output/#post-8872042)
 * ok 🙂 I will fix and let you know.
 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/breaks-json-api-output/#post-8872084)
 * you can exclude the api url as below.
 * ![wp-json](https://i0.wp.com/i.hizliresim.com/brloBG.png)
 *  Thread Starter [ov3rfly](https://wordpress.org/support/users/ov3rfly/)
 * (@ov3rfly)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/breaks-json-api-output/#post-8872134)
 * Thanks for quick workaround.
 * This should be fixed in a general way though, just think of other endpoints, 
   anything can be there, see also [register_rest_route()](https://developer.wordpress.org/reference/functions/register_rest_route/).
 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/breaks-json-api-output/#post-8872241)
 * Now I added a feature which excludes the url which start with /wp-json. Is it
   enough?
 *  Thread Starter [ov3rfly](https://wordpress.org/support/users/ov3rfly/)
 * (@ov3rfly)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/breaks-json-api-output/#post-8872269)
 * Not enough, latest Contact Form 7 uses `/contact-forms` as an endpoint. And others
   will follow.
 * Real fix: Do not add HTML-comments to non-HTML data.
 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/breaks-json-api-output/#post-8872278)
 * > Not enough, latest Contact Form 7 uses /contact-forms as an endpoint. And others
   > will follow.
 * Can you tell me the url please?
 * > Real fix: Do not add HTML-comments to non-HTML data.
 * It makes the debug easier.
 *  Thread Starter [ov3rfly](https://wordpress.org/support/users/ov3rfly/)
 * (@ov3rfly)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/breaks-json-api-output/#post-8872296)
 * > Can you tell me the url please?
 * [https://wordpress.org/plugins/contact-form-7/](https://wordpress.org/plugins/contact-form-7/)
 * > It makes the debug easier.
 * And it breaks REST-API endpoints.
 *  Thread Starter [ov3rfly](https://wordpress.org/support/users/ov3rfly/)
 * (@ov3rfly)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/breaks-json-api-output/#post-8872299)
 * See also here, this has been a problem for others as well:
    - [https://github.com/wp-cli/wp-cli/issues/2167](https://github.com/wp-cli/wp-cli/issues/2167)
    - [https://github.com/WP-API/WP-API/issues/2691](https://github.com/WP-API/WP-API/issues/2691)
 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/breaks-json-api-output/#post-8872307)
 * We should move step by step. Can you show me a sample url for “/contact-forms
   as an endpoint”?
 *  Thread Starter [ov3rfly](https://wordpress.org/support/users/ov3rfly/)
 * (@ov3rfly)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/breaks-json-api-output/#post-8872323)
 * See here: `.../contact-form-7/includes/rest-api.php`
 * But comparing strings in URLs is not an option, anything can be an endpoint, 
   see register_rest_route() docs, linked above.
 * Real fix: Do not add HTML-comments to non-HTML data.
 * For debug try something like this:
    `if ( WP_DEBUG ) error_log( 'WPFC: <!– html
   is corrupted –>' );`
 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/breaks-json-api-output/#post-8872330)
 * You are right but I cannot detect the json pages sometimes with $_SERVER[“HTTP_ACCEPT”].

Viewing 15 replies - 1 through 15 (of 31 total)

1 [2](https://wordpress.org/support/topic/breaks-json-api-output/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/breaks-json-api-output/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/breaks-json-api-output/page/2/?output_format=md)

The topic ‘Breaks JSON/REST-API Output’ is closed to new replies.

 * ![](https://ps.w.org/wp-fastest-cache/assets/icon-256x256.png?rev=2064586)
 * [WP Fastest Cache - WordPress Cache Plugin](https://wordpress.org/plugins/wp-fastest-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-fastest-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-fastest-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-fastest-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-fastest-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-fastest-cache/reviews/)

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)
 * [corrupt](https://wordpress.org/support/topic-tag/corrupt/)
 * [json](https://wordpress.org/support/topic-tag/json/)
 * [rest](https://wordpress.org/support/topic-tag/rest/)

 * 31 replies
 * 3 participants
 * Last reply from: [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * Last activity: [9 years, 3 months ago](https://wordpress.org/support/topic/breaks-json-api-output/page/3/#post-8909733)
 * Status: not resolved