Overview
Introduction
Figuring out exactly which fields a YAML config defines, especially a large, deeply nested one, usually means scrolling through the whole document and mentally tracking indentation. This tool does that walk for you and returns a flat, unambiguous list of every key's full path.
It's especially useful for comparing what two similar configs actually define, or for quickly checking whether a specific field exists anywhere in a large document.
What Is YAML Key Extractor?
A YAML key extractor walks a parsed document and records the full path to every mapping key it finds, using dot notation for nested object keys and bracket notation for array indices.
The result is a flat, newline-separated list where every entry uniquely identifies one key's location in the original document, in the order the keys appear.
How YAML Key Extractor Works
The input is parsed with a full YAML 1.2 parser, then the resulting value is walked recursively. Each mapping key extends the current path (`user` becomes `user.name` for a nested key) and is added to the output list before the walk continues into that key's value.
Array items extend the path with a bracketed index rather than a key name, since sequence items have no names of their own, and the walk continues into each item looking for further nested keys.
When To Use YAML Key Extractor
Use it to quickly answer "does this config define X field, and where?" without reading the whole document.
It's also useful for comparing the key structure (not the values) of two similar YAML files, paste each through this tool and diff the resulting key lists.
Often used alongside YAML Value Extractor, YAML Flattener and YAML Statistics.
Features
Advantages
- Produces unambiguous, directly usable paths rather than bare key names that could exist in multiple places.
- Surfaces the complete key structure of a document in one flat, scannable list.
- Handles arbitrarily deep nesting and arrays of any length.
- Runs entirely client-side, so configuration values never leave your browser.
Limitations
- Only mapping keys are listed; a document that's purely a scalar or a list of scalars produces an empty result, since there are no keys to extract.
- The output doesn't include the values alongside the keys, pair with Extract Values from YAML if you need both.
- Very large documents produce very long lists, there's no filtering or search built into the tool itself.
Examples
Best Practices & Notes
Best Practices
- Use the extracted list as a quick checklist when auditing whether a config defines all the fields a schema or template expects.
- Compare key lists from two versions of a config (rather than full diffs) when you only care about structural changes, not value changes.
- Combine with Extract Values from YAML if you need to review keys and values together rather than keys alone.
Developer Notes
The walk is a straightforward recursive path-builder: mapping keys extend the path with a dot, array items extend it with a bracketed index, and every mapping key encountered (not just leaves) is pushed onto the output list before recursing into its value. This mirrors the same path-building logic used by this site's YAML Diff and Flatten YAML tools, so paths are consistent across the category.
YAML Key Extractor Use Cases
- Auditing which fields a large, unfamiliar YAML config actually defines
- Comparing the key structure of two similar configuration files
- Checking whether a specific field exists anywhere in a deeply nested document
- Generating a checklist of config keys for documentation
Common Mistakes
- Expecting only leaf keys in the output; container keys with nested children are listed too, not just the deepest ones.
- Assuming the output includes values, it's keys only; use Extract Values from YAML for the values.
- Forgetting that array indices are zero-based when cross-referencing a bracketed path back to the original document.
Tips
- Search the output list for a specific field name to quickly confirm whether and where it's defined.
- Use YAML Statistics first to gauge how many keys to expect before extracting them.
- Pair with YAML Diff when you want to see value-level changes in addition to which keys exist.