Skip to content

YAML Ordered Mappings

Learn how to use YAML's !!omap tag to create ordered key-value pairs while preserving sequence order and avoiding duplicates.

YAML Ordered Mappings with !!omap

!!omap defines an ordered sequence of key:value pairs without duplicates.

For example:

ordered: !!omap
- Tom Nolan: 23
- Ryan Raynolds: 45
- Thomas Anderson: 28
Equivalent JSONjson
{
  "ordered": [
     {"Tom Nolan": 23},
     {"Ryan Raynolds": 45},
     {"Thomas Anderson": 28}
  ]
}
Navigation