You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PowerShell has built-in ConvertFrom-Json / ConvertTo-Json for JSON, but no equivalent for YAML. Scripts and automation that work with YAML configuration files or CI/CD pipelines must rely on external modules or manual string parsing.
What
A ConvertFrom-Yaml function that parses a YAML string into a PowerShell object, and a ConvertTo-Yaml function that serializes a PowerShell object back to a YAML string. Both functions also have a Yml noun alias (ConvertFrom-Yml / ConvertTo-Yml) for discoverability.
The module aligns with YAML 1.2.2 (October 2021) and follows the core schema for scalar resolution. Only the lowercase canonical literals true, false, null, and ~ are recognised as boolean/null types — everything else (True, Yes, On, NULL, etc.) is a plain string.
ConvertFrom-Yaml:
Accepts a valid YAML string via pipeline or -InputObject (does not read files or extract markdown frontmatter)
Returns a [PSCustomObject] by default, or an [ordered] hashtable with -AsHashtable
Supports -NoEnumerate and -Depth (default 1024)
Handles standard key-value pairs, nested mappings, and sequences
Tolerates document-start (---) and document-end (...) markers
ConvertTo-Yaml:
Accepts PowerShell objects, hashtables/ordered dictionaries, and arrays via pipeline or -InputObject
Returns a YAML-formatted string
Supports -Depth (default 1024), -EnumsAsStrings, -AsArray, and -Indent (default 2)
Quotes strings that would otherwise resolve to a core-schema literal or number, so the string type round-trips
Produces clean, readable output with proper indentation
Acceptance criteria
ConvertFrom-Yaml converts a valid YAML string to a [PSCustomObject] (default) or [ordered] hashtable (-AsHashtable)
ConvertTo-Yaml converts a PowerShell object or hashtable to a valid YAML string
Advanced YAML features like flow style, block scalars, anchors, aliases, tags, multi-document streams, and !!timestamp parsing are out of scope for this initial version — see #7, #8, #21, #22, #23, #24, #26, and #27. Markdown frontmatter extraction is also out of scope; a separate Markdown module should extract frontmatter and pipe the result into ConvertFrom-Yaml.
Why
PowerShell has built-in
ConvertFrom-Json/ConvertTo-Jsonfor JSON, but no equivalent for YAML. Scripts and automation that work with YAML configuration files or CI/CD pipelines must rely on external modules or manual string parsing.What
A
ConvertFrom-Yamlfunction that parses a YAML string into a PowerShell object, and aConvertTo-Yamlfunction that serializes a PowerShell object back to a YAML string. Both functions also have aYmlnoun alias (ConvertFrom-Yml/ConvertTo-Yml) for discoverability.The module aligns with YAML 1.2.2 (October 2021) and follows the core schema for scalar resolution. Only the lowercase canonical literals
true,false,null, and~are recognised as boolean/null types — everything else (True,Yes,On,NULL, etc.) is a plain string.ConvertFrom-Yaml:-InputObject(does not read files or extract markdown frontmatter)[PSCustomObject]by default, or an[ordered]hashtable with-AsHashtable-NoEnumerateand-Depth(default 1024)---) and document-end (...) markersConvertTo-Yaml:-InputObject-Depth(default 1024),-EnumsAsStrings,-AsArray, and-Indent(default 2)Acceptance criteria
ConvertFrom-Yamlconverts a valid YAML string to a[PSCustomObject](default) or[ordered]hashtable (-AsHashtable)ConvertTo-Yamlconverts a PowerShell object or hashtable to a valid YAML string$obj | ConvertTo-Yaml | ConvertFrom-Yamlproduces an equivalent objectNote
Advanced YAML features like flow style, block scalars, anchors, aliases, tags, multi-document streams, and
!!timestampparsing are out of scope for this initial version — see #7, #8, #21, #22, #23, #24, #26, and #27. Markdown frontmatter extraction is also out of scope; a separate Markdown module should extract frontmatter and pipe the result intoConvertFrom-Yaml.