There is 'groups' hash, when key of the hash is name of some group, and value of the hash is an array of some items. I want to encode it into JSON, but I can't event encode name of key in hash, because it's not contanstant:
x = Jbuilder.encode do |json|
groups.each do |k, v|
json.set!(:group, k)
json.group k
end
end
May be you suggest me how to execute method of 'json' using dynamic name?