In case the two hashes are always structurally equivalent, you could use a "traversal-ID" ($id here) to make the keys unique by adding the ID to the keys. It's a bit of a hack because it relies on a number of assumptions, but hopefully, it helps...