src/Serializer/BaseSerializer.php
public function serialize($data)
    {
        if ($this->serializer) {
            return \json_decode($this->serializer->serialize($data, 'json'), true);
        }

        return $data;
    }
public function serialize($data)
    {
        if ($this->serializer) {
            return \json_decode($this->serializer->serialize($data, 'json'), true);
        }

        return $data;
    }
Serialize data.

@param mixed $data

@return array