Skip to Content

Updating Failed. Invalid JSON Body Passed: Resolve the Error

Updating Failed. Invalid JSON Body Passed: Resolve the Error

WordPress is a content management system that is widely used by people all over the world for developing websites. While it’s generally a user-friendly platform, sometimes the “updating failed. invalid JSON body passed” error occurs when users try to update WordPress files, posts, and plugins. 

Don’t despair. In this article, we will explain why this error occurs and how you can resolve it.

What does updating failed the response is not a valid JSON response mean?

When you receive the invalid JSON response error message while trying to update your WordPress site, an image, or a blog post, it means that the JSON (Javascript Object Notation) data that is being sent to the server is not formatted correctly. 

This error can arise due to a number of issues.

  • A plugin is not properly configured.
  • Incorrect .htaccess file on your server.
  • The permalinks are broken, or the URL settings are incorrect.
  • There is a coding error on the server end.
  • You have not configured the SSL certificate properly.

How do I fix an invalid JSON error?

Switch to WordPress Classic Editor

The WordPress Block editor usually uses Rest API to send the update request, due to which it sometimes encounters the invalid JSON response error. To resolve the error, switch to the classic editor in the following way:

  • Navigate to your WordPress admin dashboard and head over to the Plugins option from the left-hand side menu.
  • Now, click on the Add New option, and in the keyword bar, type classic editor.
  • Next, click on the blue Install button.
  • After the installation, click on the Activate button.
  • Finally, try updating a post to see if the invalid JSON error is resolved.

Reset or update the permalinks

The permalinks allow users to update their post links to readable URLs. But, if the links are not configured correctly, WordPress will not receive a valid JSON response. Reset or update your permalinks by following the steps outlined below:

  • Open your browser and log in to the WordPress dashboard.
  • From the left-hand side menu, click on the Settings option.
  • Under the Settings, head over to the Permalinks.
  • Check the links and update them.
  • You can also select one of the default formats to avoid any errors.
  • Afterward, click on the Save Changes option and check if the error persists.

Configure the SSL 

When your website uses an SSL certificate, it secures your data, but sometimes mixed content errors can occur on your website where your website uses HTTP as well as HTTPS, generating an invalid JSON response. 

Install the Really Simple SSL plugin on your website to resolve the error. To do so:

  • Launch your WordPress dashboard and head over to Plugins>Add New.
  • In the keywords bar, type Really Simple SSL.
  • Now, click on the install button, and after the installation process, click Activate.
  • Next, head over to Settings>SSL and click on the Go ahead, activate SSL.
  • Navigate to the SSL Settings tab and toggle the buttons next to the mixed content fixer, Enable WordPress 301 redirection to SSL, and Enable 301 .htaccess redirect.
  • Finally, click on the Save option and try updating a post to see if the error is fixed.

Remove the conflicting plugin

Another reason why you are experiencing the invalid JSON error is due to plugin incompatibility or conflict with each other. Deactivate the conflicting plugin in the following way:

  • From your WordPress dashboard, head over to the Plugins option.
  • Click on the Active tab and then click on the dropdown arrow next to Bulk Actions.
  • Next, select Deactivate from the menu and checkmark the box at the start of the Plugins list.
  • Finally, click on the Apply option to deactivate all the plugins.
  • Update your WordPress website to verify the fix.
  • Now, activate the plugins one by one to check which plugin is creating conflict and deactivate it.

Note: Sometimes, the error is resulting because of the theme conflict. Therefore, you need to deactivate the plugin using your cPanel by accessing the File Manager > wp-content > themes folder > locate the theme and append .disable to its name.

Check for Rest API Conflict

REST API is used to communicate and connect to the server. However, if there is any conflict with the API, your WordPress admin backend will not be able to connect to the server, resulting in an invalid JSON response error.

To check the REST API, do the following:

  • Navigate to your WordPress dashboard, and from the left-hand side menu, select the Tools option.
  • Now, click on the Site Health option.
  • If you see the issue labeled as “the REST API encountered an unexpected result”, it means that the API is the cause of the invalid JSON error.
  • You can click it to view more details to help you fix the error.
  • If not, contact your hosting provider.

Regenerate the .htaccess file in WordPress

If you are still getting ERROR error, update your WordPress .htaccess file by following the below steps:

  • Use FTP or hosting cPanel to access the File Manager.
  • Head over to the public_html and locate the .htaccess file.
  • Right-click on the file and select Edit.
  • Delete all the code in it and place the following code lines:
# 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
  • Now, save the changes and update your website to verify the fix.

Conclusion

Unfortunately, WordPress isn’t always the most stable CMS platform, and sometimes you will run into some errors during an update process. The error “updating failed. invalid JSON body passed” means that there was an issue with the data you were sending to the server.

Hopefully, your issue will be resolved by following the above-mentioned approaches. If not, contact your hosting provider or WordPress support for further guidance and support.

Author

  • Tauqeer Ahmed

    Tauqeer Ahmed is a technology expert with over 10 years of experience in the industry. He has a degree in Computer Science and specializes in network security and software troubleshooting. You can find out more about him at https://helpfixthat.com/tauqeer-ahmed/

    View all posts

Leave a comment

Your email address will not be published. Required fields are marked *