2
PowerShellには、子メンバーが存在する場合、子メンバーをJSONオブジェクトから削除する作業ループがあります。しかし、私はこれを行うためのよりクリーンな方法があると信じています。どのようにするか知っていますか?PowerShell JSONオブジェクトの子メンバーを削除するにはどうすればよいですか
.PSObject.Properties.Remove
経由で直接それを行う、あなただけのプロパティを1つ削除すると仮定すると、
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
}
}
"PSObjectを"。それが私の必要なものです。ありがとう! – BorgRebel