ConvertFrom-Json返回“由于参数“名称”的值无效,因此无法处理参数”。

时间:2020-06-04 09:48:43

标签: json powershell convertfrom-json

当尝试使用以下代码片段将有效 json文件转换为powershell-internal表示形式时,我遇到问题:

.card > img {
    width: 100%;
    height: 100%;
}

这会触发警告[string]$changes = Get-Content -Path "C:\some\directory\with\file.json" [PSCustomObject]$changes = ConvertFrom-Json -InputObject $Changes

使用的Powershell版本是 v5.1 ,它甚至不支持Cannot process argument because the value of argument "name" is not valid. Change the value of the "name" argument and run the operation again.标志,因此我有点困惑,似乎找不到解决方法。

>

任何帮助表示赞赏...

1 个答案:

答案 0 :(得分:3)

关于此thread,输入json包含此Powershell cmdlet似乎不支持的空键。