Were you lot trying to upload a file or edit a piece of content on your WordPress site only to exist met by a scary crimson message maxim something like, "Updating failed. The response is non 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 can exist a frustrating fault considering it can get in the manner of whatsoever task you're trying to accomplish.

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

In this post, nosotros'll briefly explain what the invalid JSON response error means. Then, nosotros'll share a number of troubleshooting steps you tin implement to prepare the trouble. Grow Your Business With HubSpot's Tools for WordPress Websites

What causes the WordPress invalid JSON response fault?

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

So, why does it happen?

When yous're working in the Block Editor, the editor is in abiding communication with your WordPress site's server. This "communication" happens behind the scenes, simply it's of import to the editor.

I of the "languages" of this communication is JSON, brusque for JavaScript Object Notation. If something goes incorrect with this communication, WordPress will evidence the "The response is not a valid JSON response" message. Information technology means that the editor failed to become a response to the server or the response wasn't in a valid JSON format.

Basically, if the editor tin can't communicate with the server, information technology will show this mistake message instead.

To set the problem, yous essentially demand to fix whatever is getting in the manner of the communication.

How to Set the WordPress Invalid JSON Response Error

Now that you know what the JSON response error message ways, permit's dig into some troubleshooting steps to prepare this problem.

We'll endeavour to put these in a logical order, so that the beginning troubleshooting steps are the most probable to set the problem.

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

Fix your site's permalinks and .htaccess file.

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

Thankfully, this is also 1 of the simplest debugging steps. Hither'southward all you need to do:

  1. Get to Settings → Permalinks in your WordPress dashboard.
  2. Verify that the correct permalink construction is selected — If the correct structure is already selected, y'all don't need to change anything.
  3. Click the Salvage Changes button. Even if y'all didn't change anything, you should still click the save changes button because it will force WordPress to regenerate its rewrite rules.

WordPress JSON error fix

Now, go dorsum to the editor and see if that fixed the invalid JSON response error.

If you lot're still experiencing issues, you can guarantee that your .htaccess file is clean past deleting it and forcing WordPress to generate a new one. Hither's how:

  1. Connect to your server using an FTP customer or cPanel File Manager.
  2. Find your .htaccess file (information technology should exist in the root folder).
  3. Download a copy of the file to your computer as a backup (just in case).
  4. Delete the file from your server.
  5. Go to Settings → Permalinks in your WordPress dashboard and click Salve Changes. This volition force WordPress to generate a new, clean .htaccess file.
  6. Check if the problem is fixed.

Finally, at that place's ane terminal potential fix, merely information technology really simply applies to advanced WordPress users.

If you're working in a local development environment via a tool such every bit XAMPP, you'll too desire to make sure that you lot've properly configured the .htaccess file permissions and enabled mod_rewrite in Apache'south settings. Make sure to restart Apache once y'all've made the changes.

Check your WordPress site URL.

Some other common cause of the invalid JSON response mistake is a trouble with your WordPress site URLs.

The problem can arise if your site URLs aren't correct or if yous accidentally put HTTP instead of HTTPS (assuming your site is using an SSL document).

To fix this trouble, go 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 first with https if yous're using an SSL document on your site.

And then, save your changes.

WordPress JSON error resolution

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

Again, this is very rare because y'all need to manually add those hard-coded changes, but it can happen so it might be worth checking. For example, your WordPress programmer might have done this for you lot without letting you know.

Here's how to bank check if this is the case:

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

Hither'southward an case of what it might expect similar:

JSON error example

If you do observe these code snippets, y'all 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 utilize the URLs that you ready in your WordPress dashboard.

Check for a mixed content warning (HTTPS issue).

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

In order for your website to benefit from the security of your SSL certificate, you need to use HTTPS to load every resources on your site. If yous notwithstanding have some resource loading over HTTP, this can trigger something chosen a mixed content alarm and which causes problems with the invalid JSON response error.

In the previous section, y'all fabricated sure that your WordPress site URLs both start with HTTPS (if you lot're using an SSL certificate), which should set up many problems with mixed content already.

However, there could still be issues, peculiarly if you're using a plugin to handle migrating an older site from HTTP to HTTPS.

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

JSON error plugin fix

If you lot're not using an SSL plugin, many hosts now offer tools to force HTTPS, which you lot can detect in your hosting dashboard or by consulting your host's documentation.

Finally, if you're using Cloudflare on your site, make sure that you've set its Encryption Mode to Total (Strict) or Full. Try the Strict choice offset and and so switch to simply Total if you experience any issues.

Disable your security firewall.

If you utilize a firewall to protect your WordPress site, this can sometimes interfere with the editor's connection to your server and trigger the invalid JSON response mistake.

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

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

Of course, leaving the firewall disabled isn't a viable long-term strategy, but you at least now know what'south causing the problem and you can start fixing things.

If your firewall is implemented at the hosting level, you tin ask your WordPress host to investigate and whitelist the editor to avoid having it trigger the firewall. That way, you can maintain the protection of your site'southward firewall while even so avoiding the invalid JSON response error.

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

  1. You lot can supercede your existing firewall plugin with a different plugin that protects your site without causing issues.
  2. You can reach out to the plugin'due south developer to inquire them about whitelisting to avoid future issues.

If you lot're using Wordfence (or another plugin that has a "learning mode"), you can also try reactivating learning mode to reset its firewall rules.

Use a archetype editor plugin.

Some people report beingness able to set up the invalid JSON response fault by activating and deactivating the Archetype Editor (WordPress' sometime, TinyMCE-based editor).

It merely takes a couple of minutes, and then it'south worth seeing if this play tricks can fix your problems.

Here's all y'all need to practise:

  1. Install the official Classic Editor plugin from WordPress.org.
  2. Become to Settings → Writing and utilise the driblet-down to select the Classic Editor as the default editor for all users.
  3. Save your changes.
  4. Use the same drop-down to change the default editor dorsum to the Block Editor.
  5. Save your changes again.

Classic editor JSON error

Now, effort creating or editing a new post and come across if information technology works.

Conciliate your WordPress plugins.

Debugging WordPress errors can be tricky because the plugins that yous'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 mistake.

Ane easy way to figure out if a plugin is causing the problem is to conciliate all of your plugins.

If yous're still seeing the invalid JSON response error after deactivating everything, you can be confident that information technology's non an event with your plugins and you can reactivate them.

On the other hand, if the error goes abroad after deactivating your plugins, you know that there'south a problem with ane of the plugins that you're using.

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

From at that place, you can either supervene upon that plugin with an alternative that doesn't crusade a problem or you can reach out to the plugin's developer for aid and a potential fix.

Upload media files via the Media Library.

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

When you add an prototype block (or the cake for another type of media file), click on the Media Library option and upload files that mode instead of merely clicking the Upload button.

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

JSON error wordpress

Cheque the console and debug log.

For more than advanced users, you can try excavation into your browser'southward console or various debug logs to find a more specific problem. This isn't really a solution for casual users, though, every bit you lot'll demand some technical knowledge to accomplish annihilation here.

Get-go off, y'all can apply the Network tab in Chrome Developer Tools to find issues with Ajax calls.

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

JSON error Debug log

You tin can as well view some REST API issues from your WordPress dashboard. Go to Tools → Site Health and expect for a heading such as "The Residual API encountered an unexpected result".

Use the Archetype Editor as a curt-term gear up.

This last method isn't a permanent set, simply it is a workaround that can help yous publish content in a pinch.

Before, we told yous virtually the Classic Editor play a trick on where you switch your site to the Classic Editor only then switch back to the Block Editor.

Well, if none of the other tips have worked for you, 1 way to go on publishing content is to just leave the Classic Editor enabled and use that to create content for the time beingness.

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

Additionally, in one case you become the Block Editor working again, you'll exist able to convert your Classic Editor content into blocks with only a few clicks.

Fixing the WordPress Invalid JSON Response Error

Seeing a "Updating failed. The response is not a valid JSON response" message can exist frustrating because it appears while you're trying to piece of work in the WordPress editor.

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

In most situations, merely re-saving your WordPress permalinks should fix the problem. If that doesn't work, you lot 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 have your site performance properly over 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 7:00:00 AM, updated January xiii 2022