PowerShell Core has no built-in cmdlet for parsing YAML. The powershell-yaml module fills this gap by providing the ConvertFrom-Yaml and ConvertTo-Yaml cmdlets. The following example shows how to convert a YAML file to a JSON file:
PowerShell
$InputFile = "test.yaml"
$OutputFile = "test.json"
Install-Module powershell-yaml -Scope CurrentUser
Get-Content -LiteralPath $InputFile |
ConvertFrom-Yaml |
ConvertTo-Json |
Out-File -LiteralPath $OutputFile
#Resources
Do you have a question or a suggestion about this post? Contact me!