powershell出错,很着急,ConvertFrom-Json出错

很着急 为什么我的ConvertFrom-Json会出错,我要取json的值该怎么取,私信我
img

ConvertFrom-Json (Microsoft.PowerShell.Utility) - PowerShell | Microsoft Docs The ConvertFrom-Json cmdlet converts a JavaScript Object Notation (JSON) formatted string to a custom PSCustomObject object that has a property for each field in the JSON string. JSON is commonly used by web sites to provide a textual representation of objects. The JSON standard does not prohibit usage that is prohibited with a PSCustomObject. For example, if the JSON string contains duplicate keys, only the last key is used by this cmdlet. See other examples below. To generate a JSON string from any object, use the ConvertTo-Json cmdlet. This cmdlet was introduced in PowerShell 3.0. Note Beginning with PowerShell 6, this cmdlet supports JSON with comments. Accepted comments are started with two forward slashes (//). The comment will not be represented in the data and can be written in the file without corrupting the data or throwing an error as it did in PowerShell 5.1. https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/convertfrom-json?view=powershell-7.1

img

今日份疑惑。

$Getjsonfilecontent | ConvertTo-Json -Depth 100 | Out-File $Updatedleafjsonpath -Force
# Remove unwanted Pattern
$ReplacePatterns = @{
"\u003c" = "<"
"\u003e" = ">"
"\u0027" = "'"
}
$InputJson = Get-Content -Path $Getjsonfilecontent | Out-String
foreach ($Pattern in $ReplacePatterns.GetEnumerator())
{
$InputJson = $InputJson -replace $Pattern.Key, $Pattern.Value
}
$InputJson | Out-File -FilePath $Updatedleafjsonpath