Docs / Formats
YAML
Last updated:
Prettify reads, validates, and reformats YAML in your browser, and converts it to and from JSON, CSV, and XML. It handles multi-document files, anchors, and merge keys. This page explains that behavior and its limits.
Open the editor at /app/editor, or start from the YAML Validator or YAML to JSON tool pages.
How Prettify detects YAML
A .yaml or .yml file opens as YAML. When you paste text, Prettify tries JSON, JSON Lines, XML, and Mermaid first. Text that is none of those, yet parses as a YAML object or array, opens as YAML.
You can also set the format by hand in the sidebar or the Command Palette. Open the Command Palette with Cmd+K (Mac) / Ctrl+K (Windows, Linux).
Multi-document files
A YAML file can hold several documents, separated by ---. Prettify reads them all.
---
name: service-a
port: 8080
---
name: service-b
port: 8081
When a file has more than one document, a Documents row appears above the view, with a button per document (Doc 1, Doc 2). Select a button to view that document.
Anchors, merge keys, and tags
Prettify resolves anchors (&name) and aliases (*name). It supports merge keys (<<), and the standard explicit tags !!set, !!binary, !!omap, and !!pairs.
When Prettify reformats the document, it expands aliases into full values, so the output has no anchors.
A date-like scalar such as 2026-08-04 stays the text you wrote. Prettify does not turn it into a timestamp object.
Views
YAML gets four views. Tree, Raw, and Table are free. Diagram (Pro) draws the data as a node graph.
| View | What it shows |
|---|---|
| Tree | A collapsible tree of keys and values. The default view. |
| Raw | The reformatted YAML, with line numbers and inline problems. |
| Table | Arrays of objects as rows and columns. |
| Diagram (Pro) | A node graph with collapsible nodes. |
See Views and Diagram view.
Validation and error messages
Prettify checks YAML as you type. A syntax error carries a line and column. Prettify also adds lint warnings for common mistakes:
- Duplicate key at the same level.
- An unquoted
yes,no,on, oroff. Prettify follows YAML 1.2 and keeps these words as text, but YAML 1.1 tools, such as PyYAML, read them astrueorfalse. For example: "Prettify reads unquoted 'no' as text, but YAML 1.1 tools such as PyYAML read it as false. Quote it so every tool reads text." - A tab character used for indentation, which YAML does not allow.
The Problems panel lists every issue, so you can jump to it.
Formatting and comments
Prettify reformats YAML with two-space indentation and no line wrapping. The Raw view shows this reformatted text. Copy Formatted copies it, and Download saves it.
Comments are not kept. The YAML engine drops comments when it reformats the document, so the Raw view, a save, and a conversion do not include them. Keep a copy of the original if you need the comments.
Convert and query
Convert turns YAML into JSON, JSONL, CSV, or XML. YAML to JSON removes comments, which Prettify notes in the warning. See Conversion.
jq (Pro) filters and reshapes YAML the same way it does JSON. See jq queries. JSON Schema (Pro) validates YAML against a schema; see JSON Schema. Diff / Compare (Pro) is at Diff.
Pro is a one-time purchase of US$19.99 with lifetime access. See Pro. You can try each Pro feature once per day for free.
Limits
YAML does not use the exact-number preservation that JSON has. A very large integer or a high-precision decimal in YAML can lose precision. Keep such values in JSON when exactness matters.
Parsing and conversion run on your device. See Privacy.
Try it online
Tool pages for this topic. Each one runs in your browser.