YAML Indentation and Structure/Mappings inside a sequence

Represent a list of objects cleanly.

Section: Indentation rules

Mappings inside a sequence

yaml
yaml
users:
  - name: Jonathan
    role: admin
  - name: Sarah
    role: editor
Explanation

A common pattern for config, deployments, pipelines, and API fixtures.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Indentation rules
Sequence nested under a key
Indent list items under their parent key.
OpenIn sheetyamlsame section
Two-space indentation
Use consistent spaces for nested levels.
OpenIn sheetyamlsame section
Mixed indentation example
Illustrate a broken file caused by inconsistent nesting.
OpenIn sheetyamlsame section
Run yamllint with a custom config
Use a project-specific lint profile.
OpenIn sheetbash1 tag match
Reveal hidden whitespace
Print tabs and line endings to spot indentation issues.
OpenIn sheetbash1 tag match
Find tabs in YAML files
Locate tab characters that may break parsing.
OpenIn sheetbash1 tag match