In 2011 (WordPress 3.2), an attempt was made to remove JSON related compatibility code. However, it was discovered that a fair number of distributions were still missing the PHP JSON extension by default, and the removed code was restored to ensure compatibility.
In WordPress 5.2, the minimum version of PHP supported was raised from 5.2.6 to 5.6.20. In the 8 year period since the last attempt was made to encourage use of the PHP native JSON extension, the number of distributions with this extension disabled has significantly decreased.
Because of this, the PHP native JSON extension is now required to run WordPress 5.3 and higher.
To prevent compatibility issues, a site that does not have the PHP native JSON extension enabled will see an error message when attempting to upgrade to WordPress 5.3. The update will be cancelled and the site will remain on the current version (see ). This is to prevent potential compatibility issues on servers running custom PHP configurations.
Here’s a summary of what has changed.
The following functions and classes will remain in the code base, but will trigger a deprecated warning when used (see ):
Services_JSON_Error classes and all methods
- The (private)
The following functions, and classes have been removed entirely from the code base (see the  changeset):
json_encode() function polyfill
json_decode() function polyfill
_json_decode_object_helper() function polyfill
JsonSerializable interface polyfill
$wp_json global variable
JSON_PRETTY_PRINT constant polyfill
JSON_ERROR_NONE constant polyfill
wp_json_encode() function will remain with no intention to deprecate it at this time. This function includes an extra sanity check for JSON encoding data and should still be used as the preferred way to encode data into JSON.
For more information about these changes, check out #47699 on Trac An open source project by Edgewall Software that serves as a bug tracker and project management tool for WordPress. and the relevant changesets (, , , , and ).
Props @jrf & @jorbin for peer review.