Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Base64Json.php
Go to the documentation of this file.
1 <?php
7 
15 {
19  public function serialize($data)
20  {
21  return base64_encode(json_encode($data));
22  }
23 
31  public function unserialize($string)
32  {
33  $result = json_decode(base64_decode($string), true);
34  if (json_last_error() !== JSON_ERROR_NONE) {
35  return json_decode($string, true);
36  }
37 
38  return $result;
39  }
40 }