Title: [Plugin: JSON API] Other plugins output before json content
Last modified: August 20, 2016

---

# [Plugin: JSON API] Other plugins output before json content

 *  [socialcomputing](https://wordpress.org/support/users/socialcomputing/)
 * (@socialcomputing)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-json-api-other-plugins-output-before-json-content/)
 * Hi,
 * We are developing the [Just Map It! plugin for WordPress](http://wordpress.org/extend/plugins/jmi/)
   which uses this plugin to get data about posts and tags remotely.
 * A few users reported that the service was not working as expected and that the
   data exposed by the json services was not valid.
 * After some investigations we found that some plugins are not very carefull of
   how they output information and they are always printing javascript or html elements
   without checks.
 * These elements are also printed before the json markup returned by this plugin.
 * Would it be possible to clean all information printed on the page before outputting
   the json content and thus get rid of these issues ?
    (using ob_clean for exemple?)
 * Thanks.
 * [http://wordpress.org/extend/plugins/json-api/](http://wordpress.org/extend/plugins/json-api/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [socialcomputing](https://wordpress.org/support/users/socialcomputing/)
 * (@socialcomputing)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-json-api-other-plugins-output-before-json-content/#post-2872008)
 * Hi,
 * No news on this issue ?
    I’m pretty sure other users experience this behaviour.
   The multisite robotstxt manager plugin for wordpress tries to clean the page 
   before outputting the robot.txt content using output buffering. Taking this as
   a sample, here is a patch for the response.php singleton.
 *     ```
       --- response.php	2012-07-19 10:34:57.000000000 +0200
       +++ response.php.new	2012-07-19 10:34:12.000000000 +0200
       @@ -91,9 +91,7 @@
              header('HTTP/1.1 200 OK', true);
              header("Content-Type: application/json; charset=$charset", true);
            }
       -    ob_start(); /* why not? */
            echo $result;
       -    ob_end_flush();
          }
   
          function callback($callback, $result) {
       ```
   
 * Please make some feedback here if it worked successfully for you.

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: JSON API] Other plugins output before json content’ is closed
to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/json-api.svg)
 * [JSON API](https://wordpress.org/plugins/json-api/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/json-api/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/json-api/)
 * [Active Topics](https://wordpress.org/support/plugin/json-api/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/json-api/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/json-api/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [socialcomputing](https://wordpress.org/support/users/socialcomputing/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-json-api-other-plugins-output-before-json-content/#post-2872008)
 * Status: not resolved