/** * Specify data which should be serialized to JSON * * @return mixed data which can be serialized by <b>json_encode</b>, * @link http://php.net/manual/en/jsonserializable.jsonserialize.php */ public function jsonSerialize() { return ['amount' => $this->amount, 'currency' => $this->currency->getCurrencyCode()]; }