diff options
Diffstat (limited to 'lib/private/Accounts/Account.php')
-rw-r--r-- | lib/private/Accounts/Account.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/private/Accounts/Account.php b/lib/private/Accounts/Account.php index 540d15cd4b9..7d36af561ce 100644 --- a/lib/private/Accounts/Account.php +++ b/lib/private/Accounts/Account.php @@ -104,9 +104,16 @@ class Account implements IAccount { return $result; } - /** @return IAccountPropertyCollection[]|IAccountProperty[] */ + /** @return array<string, IAccountProperty|array<int, IAccountProperty>> */ public function jsonSerialize(): array { - return $this->properties; + $properties = $this->properties; + foreach ($properties as $propertyName => $propertyObject) { + if ($propertyObject instanceof IAccountPropertyCollection) { + // Override collection serialization to discard duplicate name + $properties[$propertyName] = $propertyObject->jsonSerialize()[$propertyName]; + } + } + return $properties; } public function getUser(): IUser { |