code: public function toJson($prettyPrint = false)
      {
          $options = 0;
          if ($prettyPrint) {
              $options += JSON_PRETTY_PRINT;
          }
          return json_encode($this->items, $options);
      }
docs: To json.
  
  @param boolean $prettyPrint Default false.
  @return string