code: public function serialize($data)
      {
          if ($this->serializer) {
              return \json_decode($this->serializer->serialize($data, 'json'), true);
          }
  
          return $data;
      }
docs: Serialize data.
  
  @param mixed $data
  
  @return array