I have a working loop in PowerShell which will remove child members from a JSON object if they exist. However, I believe there's a cleaner way to do this. Do you know how?
for ($i = 0; $i -lt $destinationReleaseDefinitionJSON.environments.Count; $i++) {
$destinationReleaseDefinitionJSON.environments[$i] = $destinationReleaseDefinitionJSON.environments[$i] | Select-Object * -ExcludeProperty queueId
for ($ii = 0; $ii -lt $destinationReleaseDefinitionJSON.environments[$i].deployPhases.Count; $ii++) {
$destinationReleaseDefinitionJSON.environments[$i].deployPhases[$ii].deploymentInput = $destinationReleaseDefinitionJSON.environments[$i].deployPhases[$ii].deploymentInput | Select-Object * -ExcludeProperty queueId
}
}