我通过 REST 从网站中提取了大量数据并将其转换为 JSON。我已经提取了我需要编辑的 JSON 中的特定条目。见下文
$variables = contains all the data converted to JSON
$dacpacvariable = contains the specific entry I need to edit (which is below)
{
"Id": "c1f4fe9b-3c4d-8j02-0e7x-0a6528bn192c",
"Name": "Variable1",
"Value": "abc123",
"Description": null,
"Scope": {
"Machine": [
"Machines-1"
]
},
}
我需要编辑范围部分,如下所示:
"Scope": {
"Machine": [
"Machines-1",
"Machines-2"
]
},
然后将具有已编辑范围的整个条目添加回较大的 JSON。
有任何想法吗?
您可以简单地将 Attribute 替换"Machine"
为其新值,例如:
$dacpacvariable = $dacpacvariable.Scope.Machine = $dacpacvariable.Scope.Machine + "Machines-2"
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句