【发布时间】:2019-08-27 09:29:51
【问题描述】:
如何使用 PowerShell 查询 JSON 文件中“类型”字符串的更改值?我无法进入“类型”字符串。
JSON 文件
{
"name": "b",
"compatibilityLevel": 1400,
"model": {
"culture": "c",
"dataSources":[
{
"type": "structured"
}
]
}}
PowerShell
$pathToJson = "C:\Model.bim"
$a = Get-Content $pathToJson | ConvertFrom-Json
$a.'model.dataSources.type' = "c"
$a | ConvertTo-Json -Depth 10 | Set-Content $pathToJson
【问题讨论】:
-
$a.model.dataSources = ,@{type = 'C'}
标签: arrays json powershell member-enumeration