Were you trying to upload a file or edit a piece of content on your WordPress site only to be met by a scary ruddy message saying something like, "Updating failed. The response is not a valid JSON response?"

The WordPress invalid JSON response error happens in the new Block Editor (AKA Gutenberg) when something goes wrong on your site. Because it appears when you're working on content, it tin be a frustrating fault because information technology can get in the way of whatever task yous're trying to accomplish.

Thankfully, at that place are some straightforward steps that you lot can take to fix this problem and get your site working properly again.

In this mail service, we'll briefly explicate what the invalid JSON response error ways. Then, we'll share a number of troubleshooting steps you can implement to ready the problem. Grow Your Business With HubSpot's Tools for WordPress Websites

What causes the WordPress invalid JSON response mistake?

If y'all see "Updating failed. The response is not a valid JSON response," it volition typically appear when you lot're working on content in the WordPress Block Editor. In some cases, it tin also appear when you're trying to upload a media file to your site, peculiarly if y'all're trying to upload the file directly to a cake in the Block Editor.

So, why does it happen?

When you're working in the Block Editor, the editor is in abiding communication with your WordPress site's server. This "communication" happens behind the scenes, but it's important to the editor.

One of the "languages" of this communication is JSON, short for JavaScript Object Annotation. If something goes incorrect with this communication, WordPress volition testify the "The response is non a valid JSON response" bulletin. It means that the editor failed to get a response to the server or the response wasn't in a valid JSON format.

Basically, if the editor tin't communicate with the server, it volition show this error message instead.

To fix the trouble, you essentially need to ready whatever is getting in the way of the communication.

How to Prepare the WordPress Invalid JSON Response Error

Now that yous know what the JSON response fault bulletin ways, let's dig into some troubleshooting steps to fix this trouble.

We'll try to put these in a logical social club, and then that the outset troubleshooting steps are the most likely to prepare the problem.

For that reason, we recommend trying these processes in the gild that we've written them.

Fix your site'southward permalinks and .htaccess file.

One of the most mutual causes of the invalid JSON response error is an consequence with your site's .htaccess file and/or WordPress permalinks.

Thankfully, this is likewise one of the simplest debugging steps. Here's all you need to do:

  1. Become to Settings → Permalinks in your WordPress dashboard.
  2. Verify that the right permalink structure is selected — If the correct structure is already selected, yous don't demand to change annihilation.
  3. Click the Save Changes button. Even if you didn't change annihilation, you lot should notwithstanding click the save changes push button considering it volition force WordPress to regenerate its rewrite rules.

WordPress JSON error fix

At present, become dorsum to the editor and see if that fixed the invalid JSON response error.

If you're nonetheless experiencing issues, you tin guarantee that your .htaccess file is make clean by deleting it and forcing WordPress to generate a new one. Here'due south how:

  1. Connect to your server using an FTP customer or cPanel File Manager.
  2. Discover your .htaccess file (it should exist in the root folder).
  3. Download a copy of the file to your computer as a backup (only in case).
  4. Delete the file from your server.
  5. Go to Settings → Permalinks in your WordPress dashboard and click Save Changes. This volition forcefulness WordPress to generate a new, make clean .htaccess file.
  6. Check if the problem is stock-still.

Finally, there's one last potential ready, but information technology actually only applies to advanced WordPress users.

If you're working in a local development environment via a tool such as XAMPP, you'll also desire to make sure that you've properly configured the .htaccess file permissions and enabled mod_rewrite in Apache'south settings. Brand sure to restart Apache once yous've made the changes.

Check your WordPress site URL.

Another common crusade of the invalid JSON response error is a trouble with your WordPress site URLs.

The trouble tin arise if your site URLs aren't correct or if you accidentally put HTTP instead of HTTPS (bold your site is using an SSL certificate).

To prepare this problem, get to Settings → General in your WordPress dashboard.

Y'all'll want to verify two things here:

  1. Brand sure that the URLs are correct. On the vast bulk of WordPress sites, your WordPress Address and Site Address should be the aforementioned.
  2. Make sure that both URLs start with https if yous're using an SSL document on your site.

Then, save your changes.

WordPress JSON error resolution

In very rare cases, your site'south URLs might have been hard-coded into your wp-config.php file. If this is so, any changes that you make via your WordPress dashboard won't apply because those hard-coded changes will override the dashboard settings.

Again, this is very rare because you need to manually add those hard-coded changes, but information technology tin happen and so it might be worth checking. For example, your WordPress developer might have done this for you without letting you know.

Here's how to check if this is the instance:

  1. Connect to your site's server using FTP or cPanel File Manager.
  2. Edit the wp-config.php file.
  3. Search for ascertain( 'WP_HOME' OR define( 'WP_SITEURL'

Here'due south an instance of what it might look similar:

JSON error example

If you do observe these code snippets, you can either:

  1. Verify that both site URLs are correct and leave the code snippets in your wp-config.php file.
  2. Remove the lawmaking snippets, which will tell your site to use the URLs that you set in your WordPress dashboard.

Check for a mixed content alarm (HTTPS issue).

If your site is using an SSL certificate (which most sites exercise nowadays), issues with mixed HTTP and HTTPS content can trigger the invalid JSON response error.

In order for your website to do good from the security of your SSL certificate, you demand to use HTTPS to load every resources on your site. If you lot still have some resources loading over HTTP, this can trigger something called a mixed content warning and which causes problems with the invalid JSON response error.

In the previous department, yous made sure that your WordPress site URLs both start with HTTPS (if you're using an SSL document), which should fix many problems with mixed content already.

However, there could withal be issues, especially if yous're using a plugin to handle migrating an older site from HTTP to HTTPS.

If you're using a plugin, make sure that you lot've fully enabled its mixed content fixer features. You lot can do this by going to Settings → SSL and enabling both the Mixed content fixer and the Burn mixed content fixer with different method toggles:

JSON error plugin fix

If y'all're not using an SSL plugin, many hosts now offer tools to strength HTTPS, which you can find in your hosting dashboard or by consulting your host'southward documentation.

Finally, if yous're using Cloudflare on your site, brand sure that you've set up its Encryption Way to Total (Strict) or Full. Endeavour the Strict pick outset and then switch to just Full if you experience any issues.

Disable your security firewall.

If you lot use a firewall to protect your WordPress site, this tin sometimes interfere with the editor's connection to your server and trigger the invalid JSON response error.

This is especially common with ModSecurity rules from your web host, though information technology likewise might be triggered by popular security plugins.

To troubleshoot this, try deactivating your firewall or security plugin and see if that fixes the problem. If the editor starts working, you lot know that something is going wrong with your firewall.

Of class, leaving the firewall disabled isn't a viable long-term strategy, but y'all at least at present know what's causing the problem and yous can start fixing things.

If your firewall is implemented at the hosting level, you can inquire your WordPress host to investigate and whitelist the editor to avoid having it trigger the firewall. That manner, you tin can maintain the protection of your site's firewall while still avoiding the invalid JSON response fault.

If you're using a WordPress security or firewall plugin, you lot have two options:

  1. You can replace your existing firewall plugin with a different plugin that protects your site without causing problems.
  2. You tin attain out to the plugin'due south developer to ask them about whitelisting to avert hereafter problems.

If y'all're using Wordfence (or some other plugin that has a "learning fashion"), y'all can also effort reactivating learning mode to reset its firewall rules.

Employ a classic editor plugin.

Some people study being able to fix the invalid JSON response error by activating and deactivating the Classic Editor (WordPress' sometime, TinyMCE-based editor).

Information technology just takes a couple of minutes, then information technology's worth seeing if this trick can set your bug.

Here'south all you need to do:

  1. Install the official Classic Editor plugin from WordPress.org.
  2. Become to Settings → Writing and use the driblet-down to select the Archetype Editor as the default editor for all users.
  3. Save your changes.
  4. Use the same driblet-downward to modify the default editor back to the Block Editor.
  5. Save your changes over again.

Classic editor JSON error

Now, try creating or editing a new post and run into if information technology works.

Deactivate your WordPress plugins.

Debugging WordPress errors can be tricky because the plugins that you're using introduce a lot of variables to the equation. With 58,000+ plugins at WordPress.org, that'due south a lot of edge cases that could be triggering the invalid JSON response fault.

One easy style to effigy out if a plugin is causing the problem is to deactivate all of your plugins.

If you're yet seeing the invalid JSON response error afterward deactivating everything, you can be confident that information technology'southward not an consequence with your plugins and you tin reactivate them.

On the other hand, if the error goes away after deactivating your plugins, you know that in that location'due south a problem with one of the plugins that you're using.

To detect the problematic plugin, you can reactivate your plugins ane by ane, making sure to test the editor after each plugin. If you activate a plugin and see the error appear right after that, yous've found the issue.

From in that location, you lot tin either replace that plugin with an alternative that doesn't cause a problem or you can reach out to the plugin's developer for assistance and a potential fix.

Upload media files via the Media Library.

If you lot're seeing the "The response is not a valid JSON response" when you try to upload media files via the Block Editor, one set up is to upload these images directly to your Media Library instead of via the block interface.

When you add together an image block (or the block for another type of media file), click on the Media Library pick and upload files that way instead of simply clicking the Upload push.

When you practice that, yous'll see the regular WordPress Media Library uploader interface, which should let you bypass the invalid JSON response fault.

JSON error wordpress

Check the panel and debug log.

For more avant-garde users, you can attempt excavation into your browser'south console or various debug logs to find a more specific trouble. This isn't really a solution for casual users, though, as you'll need some technical knowledge to accomplish anything here.

First off, yous can use the Network tab in Chrome Developer Tools to observe issues with Ajax calls.

In the Network tool, select FETCH/XHR to filter out Ajax calls and debug issues with the Residual API.

JSON error Debug log

You can also view some Residuum API issues from your WordPress dashboard. Go to Tools → Site Wellness and look for a heading such equally "The Residual API encountered an unexpected result".

Utilize the Archetype Editor as a short-term prepare.

This last method isn't a permanent fix, only it is a workaround that can help you publish content in a compression.

Earlier, we told you lot about the Classic Editor trick where yous switch your site to the Archetype Editor but then switch back to the Block Editor.

Well, if none of the other tips accept worked for yous, 1 style to continue publishing content is to just get out the Archetype Editor enabled and use that to create content for the time being.

This isn't an actual "set up" because y'all'll lose all of the functionality that the Block Editor adds. However, it will give you lot the ability to work on content while you continue debugging the "The response is non a valid JSON response" message.

Additionally, once you become the Block Editor working once more, y'all'll be able to convert your Classic Editor content into blocks with just a few clicks.

Fixing the WordPress Invalid JSON Response Error

Seeing a "Updating failed. The response is non a valid JSON response" bulletin tin can exist frustrating because it appears while y'all're trying to work in the WordPress editor.

Thankfully, for most sites, debugging this mistake shouldn't be too painful.

In nigh situations, only re-saving your WordPress permalinks should gear up the problem. If that doesn't work, yous might need to dig into other fixes such as checking your site URLs, fixing mixed content warnings with HTTPS, adjusting your firewall, and more. Implement these troubleshooting steps and you should accept your site functioning properly again in no time. Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

Originally published Jan 13, 2022 vii:00:00 AM, updated January 13 2022