Extract values from YAML using dot notation

Extract a nested value from YAML with a dot-separated path.

freeworks offlinenothing uploaded
ToolYAML Path Query
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

YAML is parsed into JavaScript values, then a dot path is followed through own object keys and array indexes. The selected value is serialized as JSON and its type and found state are returned.

  • Dot notation matches common configuration paths.
  • A root path returns the complete document.

Worked example

Extract nested address field
Query a deeply nested value from a YAML document. Set the query option to 'user.address.city'
Input
											user:
  name: Alice
  address:
    city: Portland
    state: OR
  roles:
    - admin
    - editor
										
Output
												user:
  name: Alice
  address:
    city: Portland
    state: OR
  roles:
    - admin
    - editor

											

When to use this

Deployment manifests, Ansible variables, and static-site metadata use nested lookups.

Edge cases

  • A literal dot in a key is treated as a separator.
  • An out-of-range array index is not found.
  • A scalar before the path ends stops traversal.

References