PowerShell Core doesn't provide a built-in cmdlet to parse YAML. However, there is a PowerShell module called powershell-yaml that provides the
ConvertTo-Yaml cmdlets. The following example shows how to convert a YAML file to a JSON file with PowerShell Core:
$InputFile = "test.yaml" $OutputFile = "test.json" Install-Module powershell-yaml -Scope CurrentUser Get-Content -LiteralPath $InputFile | ConvertFrom-Yaml | ConvertTo-Json | Out-File -LiteralPath $OutputFile
Do you have a question or a suggestion about this post? Contact me!