diff --git a/Account/Account.php b/Account/Account.php index 0da17b984..9714da3c3 100644 --- a/Account/Account.php +++ b/Account/Account.php @@ -31,7 +31,7 @@ use phpOMS\Validation\Base\Email; * @link http://orange-management.com * @since 1.0.0 */ -class Account implements ArrayableInterface +class Account implements ArrayableInterface, \JsonSerializable { /** @@ -468,6 +468,19 @@ class Account implements ArrayableInterface * @author Dennis Eichhorn */ public function __toString() + { + return $this->jsonSerialize(); + } + + /** + * Json serialize. + * + * @return string + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function jsonSerialize() { return json_encode($this->toArray()); } diff --git a/Account/Group.php b/Account/Group.php index a9507ca6c..dbaef5473 100644 --- a/Account/Group.php +++ b/Account/Group.php @@ -27,7 +27,7 @@ use phpOMS\Contract\ArrayableInterface; * @link http://orange-management.com * @since 1.0.0 */ -class Group implements ArrayableInterface +class Group implements ArrayableInterface, \JsonSerializable { /** @@ -195,6 +195,19 @@ class Group implements ArrayableInterface * @author Dennis Eichhorn */ public function __toString() + { + return $this->jsonSerialize(); + } + + /** + * Json serialize. + * + * @return string + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function jsonSerialize() { return json_encode($this->toArray()); }