properly encode groups as json, not ',' separated