我有这样的 JSON
[
{
"Param1":true,
"Param2":0,
"Param3":"OK"
...
...
}
]
如何使用 powershell 5.1 获取 Param2 值?现在,我试图获取属性名称,但只获取长度
$jsondeconverted = $jsonOrig | ConvertFrom-Json
$jsonOrig .PsObject.Properties |
Select-Object -ExpandProperty Name |
ForEach-Object {
Write-Host "Key : " $_
Write-Host "Value : " $thisJSON."$_"
}
编辑 这就是我得到我的json的方式
$jsonvar = '['+$jsonvar+']'
$convertedJson = $jsonvar | ConvertTo-Json -Depth 10
$deconvertedJson = $convertedJson | ConvertFrom-Json
$deconvertedJson 仅包含长度参数,仅此而已。