code: public function jsonSerialize()
      {
          $jsonConversion = [];
  
          if ($this->getSubId() != null) {
              $jsonConversion['subid'] = (int) $this->getSubId();
          }
  
          if ($this->getDescription() != null) {
              $jsonConversion['description'] = $this->getDescription();
          }
  
          if ($this->getDetails() != null) {
              $jsonConversion['details'] = $this->getDetails();
          }
  
          return $jsonConversion;
      }
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