My JSON contains this part with multiple values in EnvironmentIds variable:
Name: Test
EnvironmentIds : {Environments-102, Environments-103}
If I would have simple variable $ENV with single value I would know how to check if that value exists in that list.
$ENVIRONMENT="Environments-103"
$json | ForEach-Object {
if ($_.EnvironmentIds -contains "$ENVIRONMENT") {
Write-Host($_.Name,$ENVIRONMENT)
}
But what should I do, if $ENVIRONMENT is not a single value but a list:
$ENVIRONMENT = @ ("Environments-103", "Environments-104")
How to check if element from this list belongs - it is contained within the EnvironmentIds json list?
I want to print that specific value from the list which is contained in the JSON values.