3 ms·
$myJson = Get-Content .\test.json -Raw | ConvertFrom-Json $myJson.Accounts.Users.asmith.department = "Senior Leadership" $myJson | ConvertTo-Json -Dep
by tempaway41114 3y ago
$myJson = Get-Content .\test.json -Raw | ConvertFrom-Json
$myJson.Accounts.Users.asmith.department = "Senior Leadership"
$myJson | ConvertTo-Json -Depth 4 | Out-File .\test.json
from: https://techcommunity.microsoft.com/t5/core-infrastructure-and-security/parsing-json-with-powershell/ba-p/2768721 https://techcommunity.microsoft.com/t5/core-infrastructure-a...
- hobs 3y agoAnd the depth maxes out at 100, for some reason. This is my problem with most PS data things, they work well on the surface but when you really get your hands dirty they run like dogs or have weird limitations.