Normalize arrays and embed .priority and $key in objects.