JSON Encode and Decode | Drupal 8

JSON Encode and Decode

Submitted by editor on Wed, 05/18/2016 - 23:02
Question

How to encode and decode JSON array/string in drupal 8 way like drupal_json_encode and drupal_json_decode in drupal 7 ?

Example :

use Drupal\Component\Serialization\Json;
$json = Json::encode($data);
$data = Json::decode($json);

Add new comment