How to merge output of data resource with common id and use it as input in next resource

I want to merge output of two data resource in local variable and use the same with foreach to use in the creation of next resource.

e.g

data “azapi_resource_list” “storage” {
type = “Microsoft.Storage/storageAccounts@2022-09-01”
parent_id = join(“/” , [ “/subscriptions”, data.azurerm_client_config.current.subscription_id ])
response_export_values = [“value”]
}

data “azapi_resource_list” “files” {
for_each = {for i, k in jsondecode(data.azapi_resource_list.stora.output)[“value”] : i=>k}
type=“Microsoft.Storage/storageAccounts/fileServices/shares@2023-01-01”
parent_id = join(“/”, [each.value.id, “fileServices/default”])
response_export_values = [“value”]
}

I want to merge output of above two data resource in single with common resource id. Any help will be appreciated.