You just finished writing a post inside the WordPress Block Editor (Gutenberg), clicked Publish or Update, and a red bar pops up at the top of the screen: “Updating failed. The response is not a valid JSON response.”
Why is WordPress talking about JSON when you are just writing a blog post? Because the modern block editor communicates with your server in the background via the WordPress REST API (`/wp-json/wp/v2/`). Whenever your server returns an HTML error page or PHP warning instead of clean JSON, saving fails. Here are the 4 proven fixes.
Outgrowing Free Hosting Limits? Claim Our Partner Discounts
Upgrade to fast Hostinger LiteSpeed WordPress Hosting (with an extra 20% referral discount + free domain) or grab low-cost Namecheap cPanel Hosting & Domains with free WHOIS privacy:
Fix #1: Flush WordPress Permalinks & `.htaccess` (Fixes 50% of Cases)
If your `.htaccess` rewrite rules are missing or corrupted, requests to `yourdomain.com/wp-json/` return a `404 Not Found` HTML page instead of JSON:
- Open Settings → Permalinks in `/wp-admin/`.
- Scroll to the bottom and click Save Changes (this rebuilds your rewrite rules immediately).
- If `.htaccess` is not writable, generate a fresh WordPress rule block using our Free .htaccess Rule Generator.
Fix #2: Fix Mixed Content (`http://` vs `https://`) API Calls
If you recently installed SSL, your browser will block Gutenberg from sending REST API requests if `WP_HOME` and `WP_SITEURL` still use `http://`. Follow our Mixed Content SSL Fix Guide to align both URLs to `https://`.
Fix #3: Hide Screen PHP Warnings (`WP_DEBUG_DISPLAY`)
If an outdated plugin outputs a harmless `PHP Deprecated:` notice onto the screen, it gets prepended to the `/wp-json/` response and breaks JSON parsing! Validate raw JSON payloads in our Free JSON Formatter & Validator, and ensure `define(‘WP_DEBUG_DISPLAY’, false);` is set in `wp-config.php`.
Frequently Asked Questions (FAQ)
Why does WordPress say The response is not a valid JSON response when saving a post?
The WordPress Gutenberg Block Editor saves posts in the background using the WordPress REST API (/wp-json/). If a firewall, broken .htaccess file, Mixed Content HTTP/HTTPS mismatch, or PHP warning corrupts that background response, Gutenberg displays the invalid JSON error.
What is the fastest fix for the invalid JSON response error in WordPress?
Go to Settings -> Permalinks inside your WordPress dashboard and click ‘Save Changes’ without altering anything—this flushes WordPress rewrite rules and regenerates a clean .htaccess file.
Can Cloudflare or ModSecurity cause the invalid JSON error?
Yes. If your post contains code snippets, SQL commands, or embedded iframes, shared hosting ModSecurity rules may block the POST request to /wp-json/wp/v2/posts with a 403 HTML error page instead of JSON.