标签: convertfrom-json

ConvertFrom-Json 返回“无法处理参数,因为参数“name”的值无效。”

当我尝试使用以下代码片段将有效的json 文件转换为 powershell 内部表示时遇到问题:

[string]$changes = Get-Content -Path "C:\some\directory\with\file.json"
[PSCustomObject]$changes = ConvertFrom-Json -InputObject $Changes
Run Code Online (Sandbox Code Playgroud)

这会触发警告Cannot process argument because the value of argument "name" is not valid. Change the value of the "name" argument and run the operation again.

使用的Powershell版本是v5.1,它甚至不支持Name标志,所以我有点困惑,似乎找不到解决方案。

任何帮助表示赞赏...

powershell json convertfrom-json

4
推荐指数
1
解决办法
2978
查看次数

标签 统计

convertfrom-json ×1

json ×1

powershell ×1