Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By ianthomas_uk on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Issue links:
Description:
drupal_json_encode()
has been moved to \Drupal\Component\Serialization\Json::encode()
and
drupal_json_decode()
has been moved to \Drupal\Component\Serialization\Json::decode()
.
Drupal 7:
$json = drupal_json_encode($data);
$data = drupal_json_decode($json);
Drupal 8:
use Drupal\Component\Serialization\Json;
$json = Json::encode($data);
$data = Json::decode($json);
Impacts:
Module developers