How to Fix the Invalid JSON Error in WordPress?

Introduced with the WordPress version 5.0, Gutenberg block editor is the default editor for this content management and website development platform. WordPress experts used this revolutionary change to replace the Classic Editor with a more dynamic and flexible content creation experience. But it also accidentally brought upon the invalid JSON response error in WordPress.

Gutenberg is a client-side application without direct access to the database. So it uses the WordPress Rest API to communicate with the server. Then, it updates and stores the changes in the posts using the JSON (JavaScript Object Notation) format. The “Invalid JSON response” error in WordPress may occur when there is an issue with the JSON data being transferred between the website browser (running Gutenberg) and the WordPress server.

Any type of error while creating or updating a website, can be a little disheartening. So I have created this comprehensive guide to help you understand the causes and fix the invalid JSON error in WordPress.

But first let’s see how Gutenberg works with REST API and JSON, so we can get into the root of this error.

How does Gutenberg Work With REST API and JSON?

As you may already know, Gutenberg is a front-end or client-side application, so it runs on the developer’s browser. The block editor doesn’t have access to the server and database, which stores the WordPress pages and posts. So, to communicate with the server and send content updates, Gutenberg uses REST API and JSON.

Here’s how the communications between Gutenberg and REST API and JSON, works.

Client-Side Editing: When you use Gutenberg to create or edit content on your WordPress site, all the actions and changes you make are handled on the client-side, within your web browser (like Google Chrome). This allows for a more dynamic and responsive user interface.

Communication with REST API: To fetch data, save changes, and perform various operations related to posts, pages, and other content types, Gutenberg communicates with the WordPress server via the REST API. It sends HTTP requests to specific REST API endpoints, which are URLs designed to provide access to WordPress data.

Data Transfer in JSON Format: The data transferred between Gutenberg and the server is formatted in JSON. JSON is a lightweight, human-readable data interchange format that is easy for both machines and humans to understand. Gutenberg sends content and metadata to the server in JSON format, and the website server responds with data in the same format.

Updating and Storing Changes: When you make changes to your content in Gutenberg, such as adding or editing blocks, those changes are serialized into JSON format and sent to the server via the REST API. The server processes the JSON data and updates the corresponding posts or pages in the database.

In a gist, JSON helps WordPress create a representation of content according to the schema defined by the WordPress REST API. After editing a post or page through the block editor, you click “Update” to save the changes. That prompts Gutenberg to send a request to the server for a response in JSON format.

This combination of technologies empowers users to create complex layouts, rich media content, and custom blocks with ease. All while maintaining a consistent and structured data format for efficient server-side processing.

What is the “Invalid JSON Response” Error in WordPress?

error message for invalid json

Invalid JSON response error in WordPress occurs when there is a problem with the JSON data sent between the client’s browser and the WordPress server. It signifies the data exchange has encountered an issue, resulting in improperly formatted or corrupted JSON data. Consequently, the WordPress site may fail to perform certain actions, such as saving posts or updating content. Moreover, users may experience disruptions in the site’s functionality.

Troubleshooting and fixing the invalid JSON response error in WordPress usually involves identifying and addressing the root cause. If you encounter invalid JSON response or any of the other common WordPress errors, I recommend you hire dedicated WordPress developers.

But if you want to fix the invalid JSON error in WordPress yourself, I have mentioned the resolution methods below. But let’s first look at the common causes behind the WordPress invalid JSON response error. 

What Causes the “Invalid JSON Response” Error in WordPress?

There are several causes behind the “not a valid JSON response” error in WordPress websites. 

Server Configuration Issues: Server misconfigurations or limitations can lead to this error. It could be related to server resources, PHP configuration, or web server settings. For instance, a server running out of memory or experiencing execution time limits might produce an invalid JSON response.

Plugin or Theme Conflicts: Third-party plugins and themes can sometimes conflict with the WordPress REST API or the JSON data being transmitted. Incompatible or poorly coded plugins/themes may disrupt the communication between Gutenberg and the server. Needless to say, choose the best WordPress plugin for whatever feature or functionality you’re trying to integrate. 

Network Problems: Slow or unreliable network connections, as well as server downtime, can result in incomplete or corrupted JSON responses. If the client (browser) cannot establish a stable connection with the server, it may trigger this error.

Syntax Errors in JSON Data: JSON data must adhere to a strict syntax. Any issues with the format, such as missing or mismatched braces, quotes, or unexpected characters, can lead to an invalid JSON response.

WordPress Core or Gutenberg Updates: After updating WordPress core or the Gutenberg plugin, conflicts or compatibility issues may arise, causing JSON-related errors. Keeping all components up to date is important to minimize such issues.

Server Security Measures: Some security plugins or server security settings might interfere with the REST API’s functionality, leading to JSON errors. Security configurations should be carefully reviewed and adjusted as needed.

Resource Limitations: If the server is under heavy load or experiencing resource limitations, it may struggle to generate valid JSON responses, resulting in errors.

Database Issues: Database problems, such as corruption or inefficiency, can affect the server’s ability to provide valid JSON responses when requested by Gutenberg.

The specific reasons behind the error can vary based on the WordPress installation, so a systematic troubleshooting approach is usually necessary to pinpoint and address the issue effectively.

If you can’t diagnose what’s causing the invalid JSON response error, it would be better to contact a WordPress development company. Their experts go through the website piece-by-piece and work out the trigger behind this error in no time. After analyzing the true cause of the issue, you can work on fixing the invalid JSON error in WordPress. 

How to Fix the Invalid JSON Error in WordPress?

As seen above, there are several trigger factors for invalid JSON errors in WordPress. So you have to determine the root cause and troubleshoot error “Updating Failed. The Response is Not a Valid JSON Response.” accordingly. But here are 9 ways to fix the invalid JSON error in WordPress. 

#1 Check SSL and Mixed Content Error

Mixed content refers to a situation where your website serves both secure (HTTPS) and non-secure (HTTP) content on the same page. Browsers often block mixed content for security reasons, which can lead to issues with invalid JSON response errors in WordPress.

Here’s how you can identify the mixed content on your website:

  • To pinpoint mixed content issues, open your website in a web browser.
  • Right-click anywhere on the page and select “Inspect Element” or “Inspect”.
  • Go to the “Console” tab, which will display any mixed content errors.
  • You may see messages like the following, indicating the source of the problem.

“Mixed Content: The page at ‘’ was loaded over HTTPS, but requested an insecure resource ‘…'”.

After identifying the mixed content error, you can work on fixing it through the following techniques:

  • Update Content Links: In your WordPress database, there might be links to HTTP resources (e.g., images, scripts, stylesheets) that need to be updated to use HTTPS.
  • Update Theme and Plugin Files: Inspect your theme and plugin files for hardcoded HTTP links and update them to use HTTPS.
  • Whenever possible, use relative paths for your resource links, like “/wp-content/uploads/image.jpg” instead of “”.
  • Use HTTPS URLs: Whenever you add links or resources, ensure you use “https://” instead of “http://.”
  • Content Delivery Network (CDN): If you’re using a CDN, make sure it’s configured to serve resources via HTTPS.
  • Update Third-Party Scripts: If you’re including third-party scripts on your site (e.g., Google Fonts, Google Analytics), check their integration code and ensure it’s configured for HTTPS.
URL Settings: fix invalid json error in wordpress
  • WordPress Settings: Go to “Settings” → “General” in your WordPress dashboard and make sure both “WordPress Address (URL)” and “Site Address (URL)” use HTTPS.

After making these changes, clear your browser cache and revisit your website. Open the browser’s developer console (F12 or right-click and “Inspect”) and check for any remaining mixed content errors in the console. Resolve any that still appear.

Once you’ve resolved mixed content errors and no longer see any issues in the console, test the JSON functionality in your WordPress site to ensure the “Invalid JSON Error” is resolved.

#2 Disable the Block Editor and Switch Back to Classic Editor

Since WordPress 5.0, Gutenberg has been the default editor for the CMS. Along with the several benefits, this editor may also result in the JSON response error. So to fix the invalid JSON error in WordPress, you may try installing the Classic Editor plugin. 

switch editor

First, follow the WordPress plugin installation process and install and activate the Classic Editor. Then, open the WordPress settings and navigate to “Writing”. After that, under “Default editor for all users”, select “Classic Editor” and save the changes.

With the Classic Editor now set as the default editor, go back to the post or page where you were encountering the “Invalid JSON Error.” Edit the post/page as you normally would, but now you’ll be using the Classic Editor instead of Gutenberg.

Save or update the post/page. Check if the “Invalid JSON Error” still occurs while using the Classic Editor. If yes, you can move to other methods I have mentioned in this guide.

#3 Resolve WordPress REST API Conflict

The invalid JSON error in WordPress may be due to the way the editor communicates with the server, i.e. through the REST API. 

Resolve WordPress REST API Conflict

To investigate this error, you can utilize the WordPress Site Health tool, which provides insights into the health and performance of your website. To access it, go to “Tools” and select “Site Health”.

In the Site Health tool, you may encounter an issue labeled “The REST API encountered an unexpected result.” Clicking on this issue will provide you with additional information and clues that can help you determine whether a plugin or third-party service is causing the problem. If the problem is due to a plugin installed on the website, you may follow the method for the same, mentioned later.

Modifying your WordPress permalink and then updating the ‘.htaccess’ file accordingly can be an excellent way to fix the invalid JSON error in WordPress.

First off, you need to take backup of your WordPress website Here’s the step-by-step guide for the same:

Step 1: Log into your WordPress admin dashboard.

Step 2: Go to the “Settings” section in the left-hand menu and click on “Permalinks”.

Change the WordPress Permalink Structure & Regenerate the ‘.htaccess’ File

Step 3: In the Permalinks settings page, you’ll see several options for configuring your site’s URL structure. Choose a new WordPress URL structure from the available options.

Common choices include “Post name”, “Day and name”, and “Month and name”. Select the one that best suits your website’s SEO and content structure.

Step 4: After selecting a new permalink structure, scroll down the page and click the “Save Changes” button to apply the new settings.

If there’s still an invalid JSON error in WordPress, you may have to generate a new ‘.htaccess’ file to ensure it reflects the new URL structure.

ftp  htaccess view edit

Step 5: But first, access your website’s file and directory structure through an FTP client or the WordPress hosting provider.  Find the ‘.htaccess’ file and create a backup.

Step 6: Now, download the .htaccess file and open it with a code editor.

Step 7: Next, replace the old code with the one mentioned below:

# 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

Step 8: Then, save changes and upload it back to the WordPress root directory of your website.

Step 9: After changing the permalink structure and regenerating the .htaccess file, visit your website and perform the actions that previously triggered the invalid JSON error in WordPress.

If it is resolved, it indicates that the error might have been related to the previous permalink structure or issues with the .htaccess file.

But if it still persists, you can either keep the new structure or revert to the old one. If you want to change back to the older structure, visit the Permalink settings and select it. You may even revert back to the older ‘.htaccess’ file.

The ‘.htaccess file’ is a part of the core platform. So if you’re not comfortable with this step, look for dedicated WordPress programmers.

#5 Check the Themes and Plugins

Issues related to themes and plugins can often lead to conflicts that trigger this error.

Step 1: Log into the WordPress admin dashboard.

Step 2: Go to the “Plugins” section in the left-hand menu.

deactivate all plugins in wordpress

Step 3: Select all the plugins by checking the box at the top of the list. From the “Bulk Actions” dropdown menu, choose “Deactivate” and click the “Apply” button.

Step 4: After deactivating all plugins, visit your website and perform the actions that were previously triggering the invalid JSON error in WordPress. Check if the error persists. If it’s resolved, you’ve identified that the error was likely caused by one or more of your plugins.

Step 5: To identify the specific plugin causing the conflict, reactivate your plugins one by one and test your website after each activation.

If the error is due to a plugin conflict, it will recur when you activate the problematic one. Deactivate it again. For the error-causing plugin, check for updates. Outdated or incompatible plugins can lead to errors. So update the problematic plugin to its latest version. You may also contact the plugin developer or opt for an alternative. If you can’t find a better alternative, I suggest you opt for our WordPress plugin development services. We’ll create an excellent plugin for your website.

Moving on to the theme. Sometimes, themes can also cause conflicts that result in JSON errors.

Step 6: Temporarily switch to a default WordPress theme like Twenty Twenty-One. For that, you will need to follow the WordPress theme installation process.

Step 7: Test your website with the default theme to see if the error persists. If the error disappears with the default theme, it suggests that your previous theme might be the culprit. Then you will need to either contact the theme developer or find an alternative.

But like the plugin, if you are looking for something personalized with the design, our WordPress theme development services are just for you.

However, if the theme isn’t the culprit, you can revert back to the theme you had previously.

#6 Temporarily Disable the Security Firewall

Firewalls are among the most significant WordPress security techniques. But they can sometimes be overzealous and may erroneously block certain actions or API requests. That causes issues like the invalid JSON response. So to fix the invalid JSON error in WordPress, disable the security firewall temporarily.

Step 1: To start with, identify the security firewall or plugin installed on your website. Some of the best WordPress security plugins are Sucuri Security, Wordfence, ithemes Security, etc.

Step 2: In the dashboard, find and access the settings for your security firewall plugin.

Step 3: Look for an option to temporarily disable the firewall or put it into a maintenance mode, and follow the consequent instructions.

Step 4: After disabling the security firewall, visit your website and perform the actions that were previously triggering the invalid JSON error in WordPress. Check if the error persists.

If the error is resolved after disabling the firewall, it suggests that the security firewall was blocking legitimate REST API requests. This doesn’t necessarily mean that the firewall itself is faulty; it may have been triggered by a false positive.

Step 5: Once you’ve confirmed that the security firewall was the source of the problem, re-enable it according to the plugin’s instructions. You need to keep your website secure.

But, when activating the plugin, make sure to configure it properly to prevent false positives. That ensures your security firewall doesn’t block essential requests, review and configure the firewall settings carefully.

#7 Turn on the Debug in the WordPress

Enabling debugging allows you to capture error messages and warnings, which can provide insights into the root cause of the invalid JSON response in WordPress. Here’s how you can fix the invalid JSON error in WordPress by turning on the debugging.

Step 1: Log into the WordPress admin dashboard.

Step 2: Access the wp-config.php file located in the root directory, through the FTP client or hosting file manager.

Step 3: After locating the wp-config.php file, open and edit it through a text or code editor like Notepad or Visual Studio Code.

Step 4: Now, locate the section containing WordPress database settings in the wp-config.php, and add the following code excerpt.

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);

Here’s what each line does:

  • WP_DEBUG: This sets debugging mode to “true.”
  • WP_DEBUG_LOG: It logs debugging information to a file named “debug.log” located in the “wp-content” directory.

Step 5: Save the changes you have made to the ‘wp-config.php’ file.

After that, visit your website and repeat the actions that lead to the invalid JSON error in WordPress.

Step 6: Look for and open the “debug.log” file, i.e. the WordPress error logs, and review the content.

The entries in the debug log will provide details about what might be causing the invalid JSON  error in WordPress. Based on the debug log, you can start troubleshooting the issue. Errors and warnings in the log may point to specific themes, plugins, or server-related problems that need attention.

Step 7: Identify the cause and fix the invalid JSON error in WordPress, and then disable the debugging to prevent the indefinite growth of the debug log. For that, simply set ‘WP_DEBUG’ to ‘false’ in the ‘wp-config.php’ file.

define('WP_DEBUG', false);

After making changes based on the debug log, perform additional testing to ensure that the “Invalid JSON Error” is resolved. Although debugging in WordPress is a powerful tool for diagnosing and fixing issues, it should be performed cautiously, since it contains a lot of sensitive data.

#8 Upload Media Files Through the Media Library

As part of the troubleshooting steps for fixing the invalid JSON error in WordPress, upload the media files through the WordPress media library.

Step 1: Log into the WordPress dashboard, go to the “Media” section, and click on “Library”.

Step 2: At the top of the Media Library page and click on the “Add New” button. Then select a media file from your computer, and upload it to your website.

Step 3: If you encounter the invalid JSON error in WordPress during or after uploading the media file, take note of the details of the error message.

Step 4: If the error occurs during the media upload process, it suggests that there may be an issue related to media handling or file processing on your server. Possible causes could include server resource limitations, incorrect file permissions, or a corrupted media file.

To fix the invalid JSON response error in WordPress, try the following:

  • Check your server’s resource usage and available disk space.
  • Ensure that file and folder permissions are set correctly on your server.
  • Verify the integrity of the media file by uploading a different file to see if the error persists.
  • Contact your hosting provider for assistance with server-related issues.

You have to understand the invalid JSON error in WordPress can be due to a variety of reasons, and the resolution will depend on it. So if you want to accurately identify the cause behind the invalid JSON error in WordPress, I would suggest you hire professional WordPress developers. With their vast developer resources, these experts will diagnose and fix the invalid JSON error in WordPress quite effectively.

How do I troubleshoot the "Invalid JSON Error" in WordPress?
Troubleshooting steps may include checking themes and plugins, verifying server configurations, enabling debugging, regenerating the .htaccess file, and changing the permalink structure, among others. The specific steps depend on the root cause of the error.
What if none of the troubleshooting steps resolve the error?
If none of the above-mentioned troubleshooting steps resolve the "Invalid JSON Error," consider seeking assistance from a WordPress developer or consulting your hosting provider. They can help identify and address more complex issues that may be causing the error. Or you may opt from our WordPress website maintenance packages to identify and fix this error.
Can user permissions affect the "Invalid JSON Error"?
Yes, incorrect user permissions can potentially lead to this error. Make sure your WordPress user role has the necessary permissions to access and modify content. If you're uncertain, consult with your site administrator or hosting provider to verify permissions.


Almost every WordPress user uses Gutenberg editor for its versatility, flexibility, and outstanding user experience. But this block character also introduces a unique problem, the invalid JSON response error in WordPress.

But don’t worry, here are a few methods to fix the invalid JSON error in WordPress.

  • Check SSL and mixed content error
  • Disable the block editor and switch back to Classic Editor
  • Resolve WordPress REST API conflict
  • Change the WordPress permalink structure & regenerate the ‘.htaccess’ file
  • Check the themes and plugins
  • Temporarily disable the security firewall
  • Turn on the debug in the WordPress
  • Upload media files through the Media Library

If you still encounter an invalid JSON response or another error on the WordPress website, I suggest you consult with our experts today!

Mayur Upadhyay is a tech professional with expertise in Shopify, WordPress, Drupal, Frameworks, jQuery, and more. With a proven track record in web development and eCommerce development.

Leave a comment