Skip to content

Invoke-ConvertFromYaml

SYNOPSIS

Wrapper cmdlet for ConvertFrom-Yaml

SYNTAX

Invoke-ConvertFromYaml [-InputObject] <String> [[-Parameters] <Hashtable>]
 [<CommonParameters>]

DESCRIPTION

This is a wrapper cmdlet for calling ConvertFrom-YAML to get around the issue of loading the powershell-yaml and PlatyPS modules at the same time (https://github.com/PowerShell/platyPS/issues/592). This cmdlet allows you to pass parameters through to ConvertTo-YAML via a hashtable.

EXAMPLES

Example 1: Convert YAML

$YAML = @"
---
string: "hello, world!"
array: ["foo","bar"]
"@

Invoke-ConvertFromYAML $YAML

This would convert the above YAML document into a PowerShell object

PARAMETERS

-InputObject

The YAML data to be converted, must be a string

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-Parameters

Any parameters to pass to ConvertFrom-Yaml

Type: Hashtable
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.String

OUTPUTS

System.Object

NOTES