A Fix for Invalid JSON Error in WordPress
Sometimes, WordPress might throw up an “invalid JSON” error. This occurs when the WordPress backend cannot communicate with the web server. There are a few possible fixes for this –
- Performing simple diagnosis
- Adjusting permalinks
- Checking the Site Health page for issues
- Regenerating the .htaccess file
- Checking the WordPress URLs
If all fails, then you might need to rebuild your site from scratch or restore from a backup.
1) Perform some simple diagnosis

Before performing any of the following steps, make sure to make a full site backup.
- Switch to a default theme
- Turn off your WAF (Web Application Firewall). Most of the time, this is the issue
- Deactivate every plugin and reactivate them one by one
- Turn on debug mode to find possible issues
2) Adjusting Permalinks


- Go to Settings > Permalinks
- Select any structure other than the currently selected one
- Save your changes
Following these steps will reset your permalink structure. If you are using a custom permalink structure, ensure that there are no spelling/syntax error.
3) Checking the Site Health Page for issues


These days, WordPress includes a handy feature called “Site Health” which lists critical issues and recommended improvements. If you are facing JSON error, then you might see another error on this page – “The REST API encountered an unexpected result”. This should give you some idea regarding the error that your are getting. If you face any problem regarding logs, then you can always contact me for assistance.
4) Regenerating the .htaccess file
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
One more cause of JSON error is incorrect configuration in the .htaccess file. This file is used by Apache for different functions (such as redirection, blocking access to specific parts of the site etc.).
To rebuild the file with default WordPress config, make a backup of the current .htaccess file and delete the file from the server after taking the backup of it. Re-login into your admin panel. This should regenerate the .htaccess file with default configuration.
5) Checking the WordPress URLs

Go to settings. Here you will find two fields – WordPress Address (URL) and Site Address (URL). In most cases, both of them will be same. But, if your installation is different for any reason, make sure to double check the correct URLs. Also, if your site has a SSL certificate, make sure the URLs in these 2 fields start with https//. After making the necessary changes, make sure to change them.
Verdict
The “invalid JSON” error in WordPress can be frustrating to deal with. Fortunately, by following the methods, the error should be fixed.
In many cases, an incorrect configuration in the .htaccess file can cause this issue. Regenerating the .htaccess file can help solve the issue.
If you need any help regarding anything related to WordPress, please let me know in the comments down below.