Search code examples
jsonpowershellconvertfrom-json

ConvertFrom-Json returns "Cannot process argument because the value of argument "name" is not valid."


I face a problem when trying to convert a valid json-file into powershell-internal representation with the following code snippet:

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

This triggers the warning Cannot process argument because the value of argument "name" is not valid. Change the value of the "name" argument and run the operation again.

The Powershell version in use is v5.1 which does not even support a Name flag, so I am a bit confused and can't seem to find a solution.

Any help appreciated...


Solution

  • Regarding this thread, input json contains empty key(s) which look to be not supported by this powershell cmdlet.