Nifty YAML
Format YAML without losing comments (Kubernetes-style indents), sort keys, lint with yamllint, copy the key path, and convert to and from JSON.
Maintained. No sign-in. No telemetry. Works in VS Code, Cursor, Windsurf, VSCodium and other editors that use Open VSX.
Features




- Format YAML without losing anything. Comments, anchors and aliases, block scalars (
| and >), and multiple --- documents all survive. Works with Format Document and format on save in .yaml, Docker Compose and GitHub Actions files.
- Kubernetes-style indentation.
- item lists are indented under their key, like Prettier and kubectl output. Prefer them flush with the key? Turn off nifty.yaml.indentSequences.
- Sort Keys at every level, numbers in natural order (
item2 before item10), with comments kept next to their entries.
- yamllint built in. If yamllint is installed (
pip install yamllint), its problems show in the Problems panel as you type, using your project's .yamllint config. Each problem links to the rule's docs.
- Syntax errors and duplicate keys are flagged even without yamllint. If you use Red Hat's YAML extension this is left to it, so nothing is reported twice.
- Where am I? The key path under the cursor (
spec.template.spec.containers[0].image) is shown in the status bar. Click it, or use Copy Key Path, to copy it.
- Convert YAML to JSON and JSON to YAML (the whole file or the selection).
- Works in the browser on vscode.dev and github.dev; linting with yamllint needs the desktop app.
Commands
| Command |
What it does |
Nifty YAML: Format YAML |
Format the file (same as Format Document) |
Nifty YAML: Sort Keys |
Sort mapping keys at every level |
Nifty YAML: Copy Key Path |
Copy the path of the key under the cursor |
Nifty YAML: Convert YAML to JSON |
Open the file as JSON beside it |
Nifty YAML: Convert JSON to YAML |
Open a JSON file (or selection) as YAML |
Nifty YAML: Lint YAML Now |
Re-run the checks on the current file |
Settings
| Setting |
Default |
What it does |
nifty.yaml.indent |
0 |
Spaces per level. 0 uses the editor's tab size |
nifty.yaml.indentSequences |
true |
Indent - item lists under their key |
nifty.yaml.lineWidth |
0 |
Fold long strings at this width (0 never folds) |
nifty.yaml.quoteStyle |
preserve |
single or double converts quoted strings |
nifty.yaml.documentStart |
false |
Always start with --- |
nifty.yaml.sortKeysOnFormat |
false |
Sort keys every time you format |
nifty.yaml.validate |
auto |
Report syntax errors and duplicate keys |
nifty.yaml.yamllint |
auto |
Run yamllint when installed (on warns if it's missing) |
nifty.yaml.yamllintPath |
"" |
Path to yamllint |
nifty.yaml.showPathInStatusBar |
true |
Show the key path in the status bar |
Nifty YAML is set as the default formatter for YAML, Docker Compose and GitHub Actions files. To use a different formatter, set editor.defaultFormatter for [yaml] in your settings.
Install
- VS Code: search for "Nifty YAML" in the Extensions view, or install from the Visual Studio Marketplace.
- Cursor, Windsurf, VSCodium, Kiro, Antigravity: install from Open VSX.
Privacy
This extension collects no telemetry and needs no account.
- Nifty SQL: SQL Formatter for 20 Dialects: Format SQL in 20 dialects, including dbt and Jinja templates, with your team's settings. (Open VSX)
- Nifty XML: XPath, Formatter & XML to JSON: Evaluate XPath with namespaces, copy the XPath of any element, format, minify, check well-formedness and convert XML to JSON. (Open VSX)
- Nifty Beautify: Format HTML in PHP, Blade & Twig: Format HTML inside PHP, Blade, Twig, Jinja, Handlebars, ERB and Liquid templates without breaking the template tags. (Open VSX)
- Nifty JSON: Formatter, Validator & JSONPath: Format, minify, sort keys, query with JSONPath, copy paths, generate TypeScript types, and browse huge JSON files in a fast tree view. (Open VSX)
- Nifty C# Templates: New Class, Record & Namespace: New C# class, interface, record, enum, test and controller files with the right namespace, plus namespace syncing. (Open VSX)
- Nifty Mermaid: Mermaid Diagram Preview & Export: Mermaid diagrams with no account: live preview beside .mmd files and Markdown, diagrams in the Markdown preview, syntax highlighting, and export to SVG or PNG. (Open VSX)
See all 21 Nifty tools at https://getnifty.dev
| |