Was your WordPress plugin update or file upload blocked by a JSON error?
Are you scratching your head over an error message that keeps telling you “Updating failed. The response is not a valid JSON response” constantly?
If Yes, then don’t worry. This is not some serious bug or issue with your WordPress site.
You can fix it on your own by following the steps outlined in this tutorial. Let’s see!
- What You’ll Need to Fix Not a valid JSON response Error?
- How to Fix “Updating failed. The response is not a valid JSON response” Error: Step-by-Step Instructions
- #1. Regenerate New .htaccess File
- #2. Modify the URL Settings
- #3. Fix Mixed Content Issues
- #4. Deactivate Themes and Plugins
- #5. Look for REST API Conflicts
- #6. Change Your Image Upload Methods
- #7. Switch from Block Editor to Classic Editor
- Similar Tutorials to Check Out
- Wrapping Up
What Does it Mean When JSON is Invalid?
When you upload a file to WordPress, the server sends a response to the WordPress application after the file has been uploaded.
If that server response is not in a JSON format, or if there’s no response at all, that’s when you get the error saying that the response is not a valid JSON response.
What Makes A Valid JSON File?
There’s nothing like a valid or invalid JSON file. This error appears because of various technical issues, as you’ll see in this tutorial.
What You’ll Need to Fix Not a valid JSON response Error?
You need the following two things before you get started with the steps of fixing this error:
- WordPress Backup: Before proceeding with any of the steps outlined below, make sure to take a backup of your site. That backup will come in handy to restore your site in case something goes wrong.
- cPanel access: You’ll need access to your hosting dashboard (i.e. cPanel or whatever it is that you use to manage your server resources).
How to Fix “Updating failed. The response is not a valid JSON response” Error: Step-by-Step Instructions
There are a total of seven different reasons that can trigger this error. We’ll try to work on each of them until the error has been fixed. Let’s start!
#1. Regenerate New .htaccess File
Most JSON response errors are caused by a misconfiguration in your server’s .htaccess file.
These files are used to make configuration changes to the contents of a directory and its subdirectories, but sometimes an issue with them can lead to unexpected errors on your site, including the error we’re covering in this article.
Therefore, the first step you should take is to regenerate your .htaccess file. You can do that easily by following the steps outlined in this tutorial.
Once you’ve regenerated your .htaccess file, retry doing the action(s) that you were doing when this error surfaced. You should be able to do it normally now.
#2. Modify the URL Settings
Sometimes the JSON error also appears when your URL settings are not configured correctly in the site settings. Fortunately, changing them is easy. Just follow the steps outlined below:
Go to Settings of your WordPress dashboard;
Make sure that your URL is there in both WordPress Address and Site Address fields.
The URLs should also be identical, and they should begin with HTTPS (if you’ve installed an SSL certificate) or HTTP (if SSL is not installed);
Finally, save the changes.
That’s it! If the URL settings of your site were causing the “Updating Failed. The response is not a valid JSON response” error, then it will be fixed now.
#3. Fix Mixed Content Issues
Mixed content is when some resources (i.e. certain images, files, etc.) of an HTTPS-enabled webpage are still loading from the old, insecure HTTP-based URLs of the site.
It’s called mixed content because although the main HTML page is loading over HTTPS, some resources used on the page are loading from HTTP.
This issue also affects the appearance of the Green padlock before your site URL even after installing the SSL certificate. In most cases, the side-effect of this issue is limited to the non-visibility of green padlock only.
However, in some cases, it can also lead to a “Not a valid JSON response” error. If that’s the case, you can fix the error only by fixing mixed content issues on your site.
Here’s how to do that:
Go to Plugins >> Add New;
Search for “Really Simple SSL” and install the plugin when it appears in search results;
Activate the plugin;
Once it has been installed and activated, you’ll see a popup with a button saying “Activate SSL”. Click on it;
You’ll be logged out now. Log in again.
Now try to perform the action that you were doing when you received the JSON error. You should be able to do it now.
#4. Deactivate Themes and Plugins
Sometimes themes and plugins also conflict with themselves, causing the “Updating failed.
The response is not a valid JSON response” error. To figure out if that’s the case we need to deactivate the themes and plugins on our site and see if that fixes the error.
But before we do that, keep in mind that deactivating the theme and plugins can cause your site to break down.
You can also lose your design settings in this process. However, if you took a backup before beginning with this tutorial then you can always restore them later from the backup.
With that in mind, let’s look at your plugins first. Follow the steps given below:
Go to the Plugins screen of your WordPress dashboard;
Select all your plugins by checking their checkboxes;
Under Bulk Actions dropdown on top, choose “Deactivate” and hit the Apply button;
Check if the JSON error has been fixed or not. If yes, then start reactivating your plugins one by one;
As you activate the plugins, keep doing the action that generated the “Not a valid JSON response” error after activating each plugin.
When you find that activation of a plugin has a direct impact on the error, you’ve found the likely culprit. Delete that plugin and find an alternative for it.
If deactivating the plugins didn’t fix the error for you, try switching to a different theme by activating one of the default WordPress themes on your site (i.e. Twenty Nineteen, Twenty Twenty, etc.) and see if that fixes the error.
If it does, then the issue is with your theme and you need to find a new one.
#5. Look for REST API Conflicts
WordPress uses Rest API for communicating with the server and its applications. Sometimes if there’s an issue with the API, that can also lead to JSON errors.
To figure out if that’s the cause of errors, follow the process outlined below:
- Open your Gutenberg editor (or wherever you’re getting the “not a valid JSON response” error) in Google Chrome;
- Right-click on the error message. Then click on Inspect to open the error details in Inspect panel of your browser.
- Navigate to the Console tab. If there’s a Rest API error, it will be visible in the tab.
Now the thing is… you can’t fix this error yourself. Speak to your hosting provider along with the details of the error and they’ll tell you how this error can be fixed.
#6. Change Your Image Upload Methods
If you’re getting the error while uploading images to your site, you can try a different method of uploading them to bypass the error.
Instead of directly uploading them into a page or post, try uploading them through the Media Library section of your WordPress dashboard and then insert them into your pages or posts.
Also, make sure that your image doesn’t have any special characters in the title or filename.
Only plain English characters should be there in the filename and title of the image.
#7. Switch from Block Editor to Classic Editor
Finally, if you’re still getting the error in your Gutenberg (block) editor, try switching to the old Classic WordPress editor.
You can do it easily by installing the Classic Editor plugin from the WordPress plugin directory. This will definitely fix the issue.
Similar Tutorials to Check Out
- How to Fix the “err_cache_miss” Error: Cache files are there to make our internet browsing experience faster, but sometimes they can also create issues with the loading of certain web pages. If you’re getting the err_cache_miss error while browsing a site, that’s what’s happening to you. This tutorial can help you fix it.
- How to Fix the “err_ssl_protocol_error” Error: The err_SSL_protocol error appears when the SSL certificate validation of a site has failed. It can fail because of an issue on either side – your computer as well as the web server. This tutorial explains how it can be fixed in all those situations.
- How to Fix “Safari can’t establish a secure connection” Error: This is Safari equivalent of “err_SSL_protocol_error”. Again, this tutorial can come in handy when you want to fix it.
Wrapping Up
As we said in the beginning, you can fix this error on your own. We hope you’ve fixed it by now and are able to upload files or update your themes/plugins normally.
If you still have any issues, don’t hesitate to share them in the comments. We’ll look into them and try our best to help you.
Also, if this tutorial helped you fix the issue, share it on your social media profiles.