code: protected function toJson(RateInterface $rate)
      {
          return json_encode(array(
              'sourceName' => $rate->getSourceName(),
              'value' => $rate->getValue(),
              'currencyCode' => $rate->getCurrencyCode(),
              'rateType' => $rate->getRateType(),
              'date' => $rate->getDate()->format(\DateTime::ATOM),
              'baseCurrencyCode' => $rate->getBaseCurrencyCode(),
              'createdAt' => $rate->getCreatedAt()->format(\DateTime::ATOM),
              'modifiedAt' => $rate->getModifiedAt()->format(\DateTime::ATOM),
          ));
      }
docs: Serialize rate to JSON string.
  
  @param RateInterface $rate Rate to serialize.
  @return string JSON representation of rate.