|
/ Knowledge Base /Troubleshooting/ Fixing the “This response is not a valid JSON response”.

Fixing the “This response is not a valid JSON response”.

If you’ve recently encountered this error, which shows “This response is not a valid JSON response.” message ”while using the SureCart checkout form on your WordPress site, no worries!

In this thorough guide, we’ll explore potential causes and give you a step-by-step solutions to resolve the issue.

The response is not a valid JSON response

Let’s dive in!

Reason 1: Potential REST API Outages in WordPress

REST API is a way for different programs and websites to communicate with each other.

It is like the communication channel between SureCart and your WordPress site. If something goes wrong with this channel, you might see errors like “This response is not a valid JSON response.”

The REST API is crucial to many WordPress functionalities, including SureCart. If, for some reason, the REST API has been disabled on your site, it could be the primary cause of the error.

Sometimes, even if the REST API is enabled, it may encounter errors that can prevent it from sending or receiving valid JSON responses.

How to check?

  • Go to ‘Tools’ > ‘Site Health’ from the WordPress Dashboard.
  • Look for any issues mentioning the REST API or JSON responses.
WordPress, Site Health, REST API

If the REST API is disabled, you’ll need to re-enable it, either through the settings or by deactivating plugins that might be disabling it.

Reason 2: REST API Blocked or Altered by Server Firewall

Certain server firewalls can block or alter requests, leading to issues with the REST API’s responses. If your server has a firewall or security plugin, it might mistakenly identify REST API requests as threats.

How to check?

  • Log into your server or hosting dashboard.
  • Review the firewall settings or logs to see if any blocks or rejections correspond to the times of the reported errors.
  • If found, whitelist the necessary URLs or adjust the firewall settings.
  • If you’re unsure about accessing your server’s firewall settings or need assistance, contact your hosting support for help with resolving any firewall interference issues.

Reason 3: Debug Mode Interference

While the WordPress Debug Mode is a helpful tool for developers, having it turned on in a live environment can cause unnecessary messages to be outputted in API responses.

This can interfere with the expected structure and content of a response.

Recommendation: For live sites, it is advised to turn off the Debug Mode.

How to turn off Debug Mode?

  • Access your website’s root directory through an FTP client or file manager.
  • Locate and edit the wp-config.php file.
Turn off Debug Mode from wp-config.php
  • Find the line: define(‘WP_DEBUG’, true);
WP Debug Mode True
  • Change true to false.
WP Debug Mode false

Once done, your debug mode will be turned off.

So those were some of the reasons that could lead to the “This response is not a valid JSON response” while you use SureCart.

Additionally, you should always ensure that you routinely check the ‘Site Health’ page in your WordPress Dashboard. This tool provides direct insights into any potential issues with the REST API or other crucial site components.

In the event that you’ve checked all the above and the issue persists, consider reaching out to a developer or us, as there might be unique or advanced issues specific to your website setup.

If you need any assistance, please do not hesitate to contact us!

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
On this page

WAIT!!

You’re Missing the Biggest Discount of the Year!

Grab this rare opportunity to save up to 50%

00
Months
00
Days
00
Hours
00
Minutes
00
Seconds
00
Months
00
Days
00
Hours
00
Minutes
00
Seconds

Act Fast! The Biggest Sale of the Year is Live for a Limited Time!

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

E-Commerce Store Launch Checklist Download
Scroll to Top