我在 Powershell 中有一个 PSCustomObject,我想将其转换为 JSON。Key-Value-Pair 应该在“children”数组下。你能帮我吗?
电源外壳:
#PowershellObject
$BookmarkContainer = [PSCustomObject]@{
"roots" = @{
"other" = @{
"children" = @()
}
"bookmark_bar" = @{
"children" = @()
"name" ="FavouriteBar"
"type" ="folder"
}
}
"version"=1
}
JSON-输出:
{
"roots": {
"bookmark_bar": {
"name": "FavouriteBar",
"type": "folder",
"children": [ ]
},
"other": {
"children": [ ]
}
},
"version": 1
}
预期输出:
{
"roots": {
"bookmark_bar": {
"children": [ ],
"name": "FavouriteBar",
"type": "folder"
},
"other": {
"children": [ ]
}
},
"version": 1
}