Tranforme each item in JSON array to JSON Object

This jq should do the trick:

jq '{groups: [ .[] | {groupid: .} ]}'