--000e0cd4c08e9dfe38047f0f2d35 Content-Type: text/plain; charset=ISO-8859-1 > > given: [{"a" [1, 2]}, {"b" [3, 4]}] > > I need: [{"a" 1, "b" 3}, {"a" 1, "b" 4}, {"a" 2, "b" > 3}, {"a" 2, "b" 4}] > > Any ideas? > > Yup, the following method does nearly the same thing, except it takes arrays. You could either use this method for inspiration, or convert your desired input into my array of arrays input format and then convert the output back to your desired format. Hope that helps. def selections(arrays, results rray.new]) return results if arrays.empty? new_selection_choices rrays.shift results_with_new_selections ] results.each do |prev_selection_set| new_selection_choices.each do |selection| results_with_new_selections << prev_selection_set.clone.push(selection) end end return selections(arrays, results_with_new_selections) end selections([[1, 2], [3, 4]]) # [[1, 3], [1, 4], [2, 3], [2, 4]] --000e0cd4c08e9dfe38047f0f2d35--