【发布时间】:2017-12-17 10:48:45
【问题描述】:
所以我在这里遇到了一点问题,我似乎无法弄清楚如何更新对象中的数据值
比如说下面的 json
{
"People": 263,
"Hungry": true,
"Fruits": {
"Apples": 1 "Oranges": 2
},
"Places": {
"Places": [{
"Baskets": "true",
"name": "Room 1",
"candycount": 1500,
"candytypespresent": {
"candies": [
"caramel"
]
}
},
{
"Baskets": "false",
"name": "Room 2",
"candycount": 2000,
"candytypespresent": {
"candies": [
"caramel",
"jawbreaker",
"butterscotch"
]
}
}
]
}
}
我让 Powershell 用convertfrom-json顺利阅读
我将如何执行以下操作:
A) 将“橙子”从“2”改为“100”
B) 房间 2 中的“篮子”从“假”变为“真”
C) 将“泡泡糖”添加到 Room1 中的“糖果”
如何在不重写整个 json 或对象的情况下更新它?
【问题讨论】:
标签: json powershell object updates