ConvertFrom-Yaml¶
SYNOPSIS¶
Converts a YAML stream into PowerShell values.
SYNTAX¶
__AllParameterSets¶
powershell
ConvertFrom-Yaml [-Yaml] <string[]> [-AsHashtable] [-NoEnumerate] [-Depth <int>] [-MaxNodes <int>]
[-MaxAliases <int>] [-MaxScalarLength <int>] [-MaxTagLength <int>] [-MaxTotalTagLength <int>]
[-MaxNumericLength <int>]
ALIASES¶
This cmdlet has the following aliases, {{Insert list of aliases}}
DESCRIPTION¶
Parses YAML with the module's repository-owned YAML 1.2 parser and constructs values with the core schema. Mapping keys must be unique. Unknown application tags never activate .NET types and are treated as neutral metadata.
Pipeline strings are joined with a line feed and parsed as one stream, which supports Get-Content. Each YAML document is written separately.
EXAMPLES¶
EXAMPLE 1¶
'name: Ada' | ConvertFrom-Yaml
Converts one mapping to a PSCustomObject.
EXAMPLE 2¶
Get-Content -Path '.\config.yaml' | ConvertFrom-Yaml -AsHashtable
Joins the input lines and returns ordered dictionaries.
PARAMETERS¶
-AsHashtable¶
Return mappings as insertion-ordered dictionaries so complex, non-string, empty, or case-colliding keys survive intact.
yaml
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Depth¶
Cap YAML node nesting depth so hostile input can't exhaust the stack.
yaml
Type: System.Int32
DefaultValue: 100
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MaxAliases¶
Cap alias nodes to prevent alias-expansion amplification.
yaml
Type: System.Int32
DefaultValue: 1000
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MaxNodes¶
Cap the total node count to bound memory for a single stream.
yaml
Type: System.Int32
DefaultValue: 100000
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MaxNumericLength¶
Cap the digit count of an implicitly or explicitly typed number.
yaml
Type: System.Int32
DefaultValue: 4096
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MaxScalarLength¶
Cap decoded characters per scalar to bound per-node memory.
yaml
Type: System.Int32
DefaultValue: 1048576
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MaxTagLength¶
Cap expanded characters for a single tag.
yaml
Type: System.Int32
DefaultValue: 1024
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MaxTotalTagLength¶
Cap cumulative expanded tag characters across the stream.
yaml
Type: System.Int32
DefaultValue: 65536
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-NoEnumerate¶
Write each top-level sequence as a single array record instead of enumerating its items onto the pipeline.
yaml
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Yaml¶
The YAML text to parse. Multiple pipeline records are joined with a line feed and parsed as a single stream, which supports Get-Content.
yaml
Type: System.String[]
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: true
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
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[]¶
The YAML text to parse. Multiple pipeline records are joined with a line feed.
{{ Fill in the Description }}
System.String[]¶
{{ Fill in the Description }}
OUTPUTS¶
System.Object¶
The PowerShell value constructed from each YAML document in the stream.
{{ Fill in the Description }}
System.Object¶
{{ Fill in the Description }}