json.count @count json.competition_teams do json.array! @teams.each do |team| json.extract! team, :id, :name, :invite_code json.team_type team.en_team_type json.school_name team.user.school_name json.manage_permission current_user.id == team.user_id json.creator do json.partial! 'users/user_simple', user: team.user json.role team.team_members.find(&:creator?).en_role end json.team_members do json.array! team.team_members.each do |member| json.partial! 'users/user_simple', user: member.user json.user_id member.user_id json.role member.en_role end end end end