# Pastebin Z5jNaKp0 users = Array.new(3){|id| { "id"=>id, "username"=>"bobbyl1000", "scores"=>[ {"group_id"=>nil, "percentile_score"=>"0.3669724771"}, {"group_id"=>nil, "percentile_score"=>"0.3333333333"}, {"group_id"=>1, "percentile_score"=>"1.0"}, {"group_id"=>1, "percentile_score"=>"1.0"}, ], "avatar"=>{ "url"=>"https://s3.amazonaws.com/gamepredict/assets/logo-.png", "profile"=>{"url"=>"https://s3.amazonaws.com/gamepredict/assets/logo-profile.png"}, "small"=>{"url"=>"https://s3.amazonaws.com/gamepredict/assets/logo-small.png"} } } } result = users.map{|user| user.merge('scores' => user['scores'].select{|h| h['group_id'] == 1 }) } require 'pp' # for inspection pp result