Quickly coding a function that allows flattening a structure. The goal is to use in comparing complex structures, such as created by the ConvertFrom-JSON
or ConvertFrom-Yaml
.
Outputs a hash table.
Example:
$res = Flatten-Object @{SH = @("bin", "bash"); A = 1; B = "ZZ"; C = @{CC = "CC"}; Logic = $true}
$res.Keys | Sort-Object | % { Write-Output "$_ = $($res[$_])"}