Compare YAML configs and ignore key order
Deployment manifests, CI pipelines, and Kubernetes specs frequently reorder keys when exported from different tools. A line-by-line diff lights up entire blocks even when only replicas or timeoutSeconds changed.
Mapping key order vs. sequence order
In YAML, a mapping (key: value) is an unordered collection of key-value pairs, whereas a sequence (- item) is ordered. Sorting mapping keys removes structural noise without scrambling ordered lists like middleware pipelines or webhook endpoints.
# Before (Content A)
runtime:
replicas: 2
timeoutSeconds: 15
# After (Content B)
runtime:
timeoutSeconds: 30
replicas: 4
Reordering keys within runtime should disappear when comparing configuration semantics, while changing replicas from 2 to 4 and timeoutSeconds from 15 to 30 must remain highlighted.
Try the YAML workflow
- Open the working YAML example below.
- Notice how reordered sections make almost every line look modified at first.
- Enable Sort keys in the toolbar.
- Folio sorts YAML mapping keys recursively while preserving sequence order and comments, collapsing the view down to the actual configuration changes and showing each field's YAML path in Inspect.
Open the YAML key-order example
Know the edge cases
- YAML merge keys (
<<): Mappings using merge keys (<<: *defaults) retain their original key order in Folio so override precedence is never misread. - Duplicate keys and syntax errors: If either input has duplicate keys or invalid YAML syntax, Folio pauses key sorting on both documents and marks the exact source line and column so you can inspect safely.
- Local-only processing: Everything parses inside a local browser worker with no server uploads.
folio