Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Static Public Member Functions
JsonConverter Class Reference

Static Public Member Functions

static convert ($data)
 

Detailed Description

This class was introducted only for usage in the \Magento\Framework\DataObject::toJson method. It should not be used in other cases and instead \Magento\Framework\Serialize\Serializer\Json::serialize should be used.

Definition at line 13 of file JsonConverter.php.

Member Function Documentation

◆ convert()

static convert (   $data)
static

This method should only be used by \Magento\Framework\DataObject::toJson All other cases should use \Magento\Framework\Serialize\Serializer\Json::serialize directly

Parameters
string | int | float | bool | array | null$data
Returns
bool|string
Exceptions

Definition at line 23 of file JsonConverter.php.

24  {
25  $serializer = new \Magento\Framework\Serialize\Serializer\Json();
26  return $serializer->serialize($data);
27  }

The documentation for this class was generated from the following file: