properly encode groups as json, not ',' separated

fixes https://github.com/owncloud/core/issues/9774 for master.

Multiselect expects the groups to be an array, not a comma separated string.

@blizzz @nickvergessen @PVince81 It seems this ajax file is only used by users.json.

@karlitschek @craigpg will backport to stable7 and stable6 when reviewed.
fix call to deprecated class