Have you ever tried to upload content on WordPress, but all you got were error messages? A more critical of those errors is the Updating Failed. The Response is Not a Valid JSON Response which may puzzle you on what to do next.
When you notice glitches like this, don't fret. We have compiled for you how to confront frustrating situations like this. We also exemplified why your site is affected so you may guide against such problems in the future.
Why Do We Encounter the “Updating Failed. The response is not a valid JSON response.” Error?
Whenever you edit or upload content on your WordPress site, the page sends a request to the server and awaits a response. The JavaScript function on the page sends a request, which goes through a JSON format.
If for any reason, the JavaScript code refuses to run as expected, it'll trigger the system to show the error message: “Updating Failed. The Response is Not a Valid JSON Response” error.
Users may also receive the message if the WordPress page can’t connect to the host server.
Various factors could inflict an error on your site’s JavaScript code or the connection between the editor and the server. It could be a side effect of a problem from your web server, .htaccess file, SSL certificate, plugin, or WordPress theme. It could also result from a misplaced URL setting or a broken link.
How to fix “The Response is Not a Valid JSON Response.” Error
To fix critical errors like “The Response is Not a Valid JSON Response.”, we need to investigate where the error initially originated. Below are some of the first steps you might want to take:
Re-Generate a New .htaccess File
The .htaccess file is a significant component of WordPress. It is the configuration file with which the administrator can keep their SEO URLs – otherwise known as permalinks. Generally, WordPress automatically generates this .htaccess file and updates it for the user, but that sometimes doesn’t work.
When the .htaccess file isn’t updated, the permalinks will get broken, triggering the “Updating failed. Error message: The Response is Not a Valid JSON Response.” Error.
Therefore, you must delete the existing .htacess file and have the WordPress system manually generate a new and updated one afterward.
You can start the process by connecting to your WordPress hosting account dashboard through an FTP tool. That should give you access to the root or public html folder; select the .htaccess file, backup it in another folder on your computer, and then delete it.
Complete the process by going to the WordPress Dashboard > Settings -> “Permalinks” submenu in the settings and selecting the “Save Changes” option. This should clean out the old .htaccess file and have WordPress generate a new one for the site. If all goes well, the “The Response is Not a Valid JSON Response.” The error would have vanished when next you refresh the site.
In case your htaccess is not generated you can use this basic WordPress .htacces file:
# BEGIN WordPress
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Confirm the WordPress Address Site Settings
If you still notice an error message on the screen after updating the .htaccess file, check the address settings on the site next. Incorrect URL settings are known to cause the “Publishing Failed. The Response is Not a Valid JSON Response.” error as well.
WordPress sites with an SSL certificate typically require HTTPS content. You'd get the error message if an HTTP link finds its way into the page. So check the content on your WordPress editor if there is any no HTTPS link.
You can fix JSON issue by ensuring that the WordPress address settings are in the proper configuration. To do that, go to the “General” submenu under the dashboard settings, and make the necessary changes to the WordPress Address (URL) and Site Address (URL). Once you’re through, you can click on “Save Changes” to effect the change.
To confirm if the JSON response WordPress error is now gone, try to edit a post on the site by adding a new block in the editor and saving it.
Fix All Content Warning Issues
Most WordPress sites now use SSL certificates, as it’s a much safer configuration for websites. The certificates let the site administrator run HTTPS connections on the site pages.
However, it does happen that your site has some resources that still use HTTP connection, perhaps due to a transition from an older website. The combination of the HTTP and HTTPS content on the site will cause a mixed content warning, throwing the “The Response is Not a Valid JSON Response.” Error subsequently.
As discussed above, confirming the address site settings is supposed to fix the JSON error, but you might need to take a thorough approach by fixing the content warning issues instead.
You’d need an SSL WordPress plugin that runs through the site, updating all the connections to HTTPS.
Easy HTTPS Redirection (SSL) is a great WordPress plugin we recommend in this situation. Tap on the Plugin section of your dashboard menu to look up “Easy HTTPS Redirection (SSL)” plugin and activate it.
Another easy plugin to use is Velvet Blues Update Redirect Url which is pretty easy to replace all your old HTTP links with HTTPS
Source: WordPress.org
Once the plugin completes its scan, it will log you out of the panel so you can get back in afresh. The “The Response is Not a Valid JSON Response.” should be gone when you open the block editor at this point.
Deactivate Plugins and Themes
Still, getting the “The Response is Not a Valid JSON Response.” error after the above workarounds? It’s time to turn your attention to your plugins and themes.
One of the two components(themes, plugins) can break your WordPress system and throw a “The Response is Not a Valid JSON Response” error. Deactivating them one by one can help you identify the culprit and deleting them.
However, deactivating plugins and themes on your WordPress will most likely break its configuration. We recommend you have a recent site backup so the process doesn’t ruin your site.
Enter the “Themes” submenu in the “Appearance” tab. Select each default WordPress theme in the option and check if the error is gone. If it’s no longer there, delete the theme you last activated; otherwise, reactivate the previous one.
Move over to the “Installed Plugin” section and select those that you have using the “Bulk Actions” options. Deactivate them to see if the “The Response is Not a Valid JSON Response.” error is gone. If it is, then one of the plugins is to blame. Reactivate each of the plugins, and check if the error is back after each action. Simply delete the offending plugin when you find it.
Alternative Ways to Identifying a JSON Error
If you still get the error. Below are some of the quickest ways to identify them:
Upload Files Differently
If an incorrect upload causes the JSON error, it’s possible that you miss it even after changing the site’s configuration. You can identify the issue in such a case by changing how you upload images and other content entirely. Try uploading your resources through the Media Library, and see if the problem persists.
However, don't include invalid characters in your upload titles, as that would still cause the error. The recommendation is only to use English letters and recognized characters when titling the images you wish to upload.
Resolve REST API Conflicts
WordPress handles its server communications using the REST API. Therefore, you can deduce that the REST API has something to do with any “The Response is Not a Valid JSON Response” error you get. Typically, the system throws errors whenever the API can establish the proper connection.
To confirm if the REST API is the cause of the error, check to see if it has any pending errors in Tools -> Site Health. Navigate to your Block editor on the page where the JSON error appears and select “Inspect” after a right-click on the Chrome Browser.
In the “Console” tab of the “Inspect” environment, check if you can find a recent REST API error. If present, then the culprit all along was the API. At this point, we’d like to mention that you’d need assistance from your hosting provider to resolve the REST API error, as you might have access to do it yourself.
Switch to the Classic Editor
We’d imagine the error would have gone if you’d tried all the steps until this point. However, if the “The Response is Not a Valid JSON Response” persists, you can switch to the classic editor as a last resort. Depending on the cause of the error, you might have to make the switch temporarily or permanently.
Start by installing the Classic Editor plugin and running your site pages through it. You might have to switch to the block editor to see if the error persists. If you would instead not go through the back-and-forth, stick with the classic editor permanently.
Conclusion
WordPress site administrators understand that the system has some common errors as they interact with it regularly. Perhaps the most common of those errors is the “The Response is Not a Valid JSON Response”, which mainly occurs on the Gutenberg block editor on the new versions of WordPress. This error baffles users, partly because its causes are numerous and identifying it might have you jumping through hoops.
It could be a broken link, SSL certificate, or a plugin or theme that causes the site to throw the error. However, when you know the proper steps, you can quickly identify and remove the cause. We’ve discussed some of the niftiest ways to help you fix an “Update failed. The Response is Not a Valid JSON Response” error in no time.
Some techniques are more technical than others, and if the error doesn’t go away after trying them all, you can contact your site administrator. Be sure to explain the steps you’ve taken up to that point. They’d probably have a better technical understanding, clearing the error for you.
FAQs
In WordPress websites, a JSON response renders invalid when it has an unknown character. Typically, each WordPress needs to communicate with the host server, and they do that by sending JavaScript requests. Now: the JavaScript commands get sent in a JSON file, and the response comes the same way.
Over the course of the connection, if the JavaScript has a wrong character – say a broken permalink or mistitled content – the response becomes invalid, and you get the “The Response is Not a Valid JSON Response”
Technically, an empty JSON response isn’t valid. But that’s because you can’t get an empty response in the first place. The system first converts the empty response into an empty string before sending it; an empty string is an invalid response here.
No. The hosting service determines how it delivers HTTPS content response, which often happens to be JSON on WordPress. The REST API is responsible for JSON responses, and even then, it won’t always throw JSO responses.
Depending on the configuration and the errors it has, the REST API might be the cause for a “The Response is Not a Valid JSON Response” error. If this happens to you, the hosting service might be able to help you out if all else fails.
Yes. HTTPS content requests are character sensitive. If you introduce an unknown character when editing or uploading content to the site, you will likely get a “The Response is Not a Valid JSON Response” error. Check your image titles to ensure they are English characters.
Godwin has spent more than 5 years crafting engaging web articles for martech companies. He has contributed to Benzinga, Entrepreneur, Hackernoon, Blocktelegraph, and some other top martech brands that prioritise solutions to challenges online businesses face.
Comments