我在Gite Hub有一份与下文类似的现有杰森档案。
{
"quiz": {
"sport": {
"q1": {
"question": "Which one is correct team name in NBA?",
"options": [
"New York Bulls",
"Los Angeles Kings",
"Golden State Warriros",
"Huston Rocket"
],
"answer": "Huston Rocket"
}
},
"maths": {
"q1": {
"question": "5 + 7 = ?",
"options": [
"10",
"11",
"12",
"13"
],
"answer": "12"
},
"q2": {
"question": "12 - 8 = ?",
"options": [
"1",
"2",
"3",
"4"
],
"answer": "4"
}
}
}
}
我想在使用强国歌的“数学”上增加新的关键和价值。 我在把 g带回我的当地司后,在指挥下受审。
$FilePath = C:Users est.json
$y = Get-Content $FilePath | ConvertFrom-Json
$value = @`
{
"question": "12 - 6 = ?",
"options": [
"1",
"2",
"3",
"6"
],
"answer": "6"
}
`@
$resultObject = $value | ConvertFrom-Json
$y.quiz.maths | Add-Member -MemberType NoteProperty -Name "q3" -Value $resultObject
$y | ConvertTo-Json -Depth 3 | Set-Content -Path $FilePath
随后承诺并推动这些变化。 当我检查主要分支与我的特工部门之间的比较时,由于新的白色空间,整个档案已经改写。
注:
- "-compress" command did not help here
- If I merge and again raise a PR with new values, It gives that specific commit only but this will continue unwanted whitespaces
问题;
页: 1 如果没有不想要的白天空间,是否有这样做的适当途径。
2. Can we do it without transforming into PowerShell Object. 我知道,我们可以将它变成一个使用——Raw方案,然后我们如何在新财产之上增加,并作出只有具体改动的单一承诺。
3。 除以上2种选择外,是否还有其他办法为使用PowerShell的案卷增添新的价值?