code: public function jsonSerialize()
      {
          $jsonDetails = [];
  
          if ($this->getConversionDate() != null) {
              $jsonDetails['conversion_date'] = $this->getConversionDate()->format('Y-m-d');
          }
  
          if ($this->getRevenue() != null) {
              $jsonDetails['revenue'] = $this->getRevenue();
          }
  
          if ($this->getTotalConversions() != null) {
              $jsonDetails['total_conversions'] = $this->getTotalConversions();
          }
  
          if ($this->getIpAddress() != null) {
              $jsonDetails['ip_address'] = $this->getIpAddress();
          }
  
          if ($this->getConversionType() != null) {
              $jsonDetails['conversion_type'] = $this->getConversionType();
          }
  
          if ($this->getLinkPosition() != null) {
              $jsonDetails['link_position'] = $this->getLinkPosition();
          }
  
          return $jsonDetails;
      }
docs: (PHP 5 &gt;= 5.4.0)<br/>
  Specify data which should be serialized to JSON
  @link http://php.net/manual/en/jsonserializable.jsonserialize.php
  @return mixed data which can be serialized by <b>json_encode</b>,
  which is a value of any type other than a resource.
  @throws \Exception