Website Without PHP
English (United States)US
  • English (United States)
  • Dutch (Netherlands)
Menu

Last updated:

Which PHP version does your site report?

We read only what your site already sends in public: the headers and the top of the homepage. No scan, no login.

Investigate JsonException in PHP

Get help with your website

Error

What the message means

JsonException reports a JSON error when the call uses JSON_THROW_ON_ERROR. Inspect the error code and operation: encoding and decoding require different investigations. For decoding, json_decode expects UTF-8.

First establish what actually reached the parser; an unsuccessful integration request may have supplied something other than the document the application expected.

Before you change anything

Save the complete error line and its timestamp in a private note. Record the failed action, the active PHP version and any components updated at the same time. Do not post passwords, customer details or full server paths in a public support forum.

Back up both files and the database before making changes. Check that the backup can actually be restored. Use a protected test copy with the same PHP version and relevant settings, with real payments and outgoing customer emails disabled.

Recognize a broken document

A minimal example is json_decode('{', true, 512, JSON_THROW_ON_ERROR);. The document ends immediately after its opening brace. PHP throws JsonException with the message Syntax error.

Using json_decode('{"id":7}', true, 512, JSON_THROW_ON_ERROR) gives the developer a valid comparison case. Both examples contain invented data.

An integration might instead return an HTML error page. When investigating that possibility, inspect its HTTP status together with the response. Do not remove random characters until parsing stops complaining.

Valid JSON can also contain a single value such as null; your application must still decide whether the required product fields exist. Valid syntax and suitable import data are separate checks.

Trace the failing operation

Start with a small anonymized copy of the failing input. Ask the developer to reproduce the issue outside the full import. For an external integration, record the HTTP status and expected response format as well.

Investigate whether an error page or truncated response reached the JSON parser instead of the intended data.

Do not remove exception handling simply to make an import appear successful. Agree how a rejected document becomes visible and which records must remain unchanged. Never submit customer data to an online validator.

Build a local test document with the same structure and invented values. Have the administrator define when retrying is safe and how duplicate processing will be checked.

Five steps to repair

  1. Record the error code and timestamp. Establish whether JSON encoding or decoding failed and identify the call responsible for the exception.
  2. Create a small document without personal data. Verify the expected response format and, for an integration request, the HTTP status.
  3. Repair the invalid data source or implement the agreed failure handling. Preserve a visible distinction between rejection and successful processing.
  4. Test a valid document, malformed data and an empty response. Check the required application fields after decoding as a separate step.
  5. Inspect saved records and the administrator message. Retry only through the agreed recovery route and check for duplicate processing.

A concrete acceptance test

Use an import containing two invented products. Let a valid document make the expected changes. Then submit a truncated document and confirm that it remains visibly failed without unnoticed changes to existing products.

Repair the document and check an authorized retry. Agree the expected record counts in advance. An exception disappearing without the correct products being saved is not acceptance evidence for this integration.

Updating WordPress or WooCommerce components

If the error points to a plugin or theme, first check whether its author documents a relevant update. Record the installed version before trying that update on the test copy. Include any custom extensions that depend on the component in your checks.

Avoid editing supplier files without an agreed maintenance plan. A later update can overwrite a manual repair. For custom code, ask for a change that is kept with the source code and can be tested again during the next PHP update.

When to ask for help

Use the existing PHP update service if you cannot trace the error or if it affects orders, payments or saved records. Describe the failed action and the expected result in the help form below. An error message alone does not identify which component needs to change.

Check your PHP version

Use the Exposure Check link below this article to check your PHP version where it is publicly visible. If that information is unavailable, ask your host to confirm the active version. This check cannot read private logs and does not prove that the programming error is fixed.

Visit the PHP security status page for the separate assessment of your PHP version. Save the versions, code change and test outcome in your maintenance notes. Let the responsible maintainer decide when the tested repair should be applied to the live website.

Frequently asked questions

Can I remove JSON_THROW_ON_ERROR?

Do not treat that alone as a repair. Establish why the input fails and how rejected documents remain visible without unintended changes to saved data.

Can the mini-check prove this cause?

No. A public check does not replace investigation of private logs and server settings. Use the error message and failing action as the starting point.

When is the repair complete?

When the original action produces the correct result and fresh logs show no recurrence. Keep the versions and test result in your maintenance notes.

Sources

Accessed on 9 November 2026.

  1. Domain
  2. Check
  3. Result
  4. Report

Which PHP version does your site run?

Enter your domain. We read only what your site already sends in public: the headers and the top of the homepage. No scan, no login.

We keep the domain and the result, never your IP address.