folio.

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

  1. Open the working YAML example below.
  2. Notice how reordered sections make almost every line look modified at first.
  3. Enable Sort keys in the toolbar.
  4. 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