Table of Contents
Have you ever attempted to upload a file or change a piece of content on your WordPress site only to be met with a terrifying red notification that reads, “Updating failed. The response is invalid JSON”. This invalid JSON error typically occurs when you update or edit your WordPress posts. Getting this error message while editing can be disruptive and annoying at times. Don’t worry while this message may appear foreboding, there are some simple fixes that can be implemented to avoid this problem in the future.
When you upload an image to your WordPress website, or publish or update a post, WordPress sends the request to your web server. The server returns results in JSON format. If the server does not respond in JSON format or does not respond at all, WordPress returns “The response is not a valid JSON response.” error. You’re probably wondering what causes miscommunication or a lack of communication between your website and the server. The answer is that there are multiple causes. It could be a bug in a plugin or theme, an SSL certificate issue,.htaccess file corruption, a REST API conflict, or something else. Below we have mention the steps to Fix Invalid JSON Error in WordPress.
Ways to Fix Invalid JSON Error in WordPress
Use a classic editor plugin
Check the console and debug log
To find a more specific problem, advanced users can dig into their browser’s console or various debug logs. This isn’t a solution for inexperienced users, as you’ll need some technical knowledge to accomplish anything here. To begin, you can use the Network tab in Chrome Developer Tools to troubleshoot Ajax calls. Select FETCH/XHR in the Network tool to filter out Ajax calls and troubleshoot REST API issues. From your WordPress dashboard, you can also view some REST API issues. Go to Tools → Site Health and look for a heading such as “The REST API encountered an unexpected result”.
Check WordPress URLs in Settings
First, double-check that your WordPress Address and Site Address are correct. Simply navigate to the Settings » General page. Review the WordPress Address (URL) and Site Address (URL) fields from here. This setting must have the same URL in both fields for most websites. However, it is possible that some users have given WordPress its own directory and are serving the website from a different address. In that case, different URLs can be used here. However, if your Site Address is incorrect, WordPress will display the invalid JSON error. If you made any changes to the settings, remember to click the Save Changes button to save your changes. You can now edit a blog post to see if adding new blocks or saving it causes the ‘Not valid JSON response’ error.
Deactivate All WordPress Plugins
WordPress plugins can occasionally clash with one another or with the WordPress core. This could lead to unexpected behavior and be one of the causes of the invalid JSON error. Simply navigate to Plugins » Installed Plugins. Select all of your WordPress plugins and then select ‘Deactivate’ from the Bulk Actions drop down menu. To proceed, click the Apply button. You can now try to reproduce the error once more.
If the error goes away, it means that one of the plugins installed on your website was the source of the problem. To determine which plugin is responsible, you must first activate each one and then attempt to reproduce the error. Rep this process until you find the culprit. After that, you can contact the plugin’s author for assistance or look for an alternative plugin.
Temporarily Switch to the Classic Editor
If all of the preceding steps fail, you can switch to the Classic Editor for WordPress. This older version of the WordPress editor employs a simpler text editor and does not heavily rely on the REST API to obtain JSON responses. You must install and activate the Classic Editor plugin before you can use it. For more information, see our step-by-step guide to installing a WordPress plugin. The plugin works right away and disables the Gutenberg editor when activated. You can now work on your website and return to the troubleshooting later.
What causes the WordPress invalid JSON response error?
If you notice “The update failed. The response does not conform to JSON standards “It usually appears when you’re editing content in the WordPress Block Editor. It may also appear when you try to upload a media file to your site, particularly if you try to upload the file directly to a block in the Block Editor. When you work in the Block Editor, the editor is in constant communication with the server of your WordPress site. This “communication” takes place behind the scenes, but it is critical to the editor.
JSON, which stands for JavaScript Object Notation, is one of the “languages” used in this communication. If this communication fails, WordPress will display the “The response is not a valid JSON response” message. It indicates that the editor did not receive a response from the server or that the response was not in a valid JSON format. If the editor is unable to communicate with the server, this error message will be displayed instead. To solve the problem, you must first eliminate whatever is impeding communication.
Final Words
It’s a common WordPress error that can appear on your site for a variety of reasons, including plugin and theme conflict, SSL certificate or mixed content issues,.htaccess file corruption, and so on. It’s infuriating to get the JSON response error. It doesn’t tell you why it’s happening or how to fix it; instead, it forces you to stop everything you’re doing and figure out how to fix the error on your website. Visit their official website for more information.