这是一种方法:
$a = Get-Content 'D:tempmytest.json' -raw | ConvertFrom-Json$a.update | % {if($_.name -eq 'test1'){$_.version=3.0}}$a | ConvertTo-Json -depth 32| set-content 'D:tempmytestBis.json'根据@FLGMwt和@mikemaccana,我改进了
ConvertTo-Jsonwith,
-depth32因为默认深度值为2,对于深度大于2的对象,尽管有对象,您仍会收到类信息。



