Skip to main content

YAML Viewer

Explore the structure of a YAML document as an expandable tree.

What it does

YAML Viewer shows a YAML document as a tree you can open and close, so you can see how it is built without counting indentation. Mappings and lists become branches, values become rows, and anchors, tags and aliases are marked on the row where they appear.

It is for looking, not for rewriting: your text is not changed. To tidy the text use YAML Formatter, and for a plain valid or not valid answer use YAML Validator.

What it supports

  • YAML read under the YAML 1.2 Core rules, as one document or several separated by ---: mappings, lists, comments, anchors, aliases, multi-line text blocks (| and >) and the standard YAML tags such as !!str.
  • With more than one document, the tree starts with a list that has one row per document, numbered from 0 in the order they appear. Each document keeps its own anchors, so an alias refers only to an anchor in its own document, and the path after its arrow starts with the number of the document. An empty document is shown as an empty value.
  • Every mapping and list is a branch that shows how many entries or items it holds. Values are shown exactly as written in your text: quotes stay, 1.50 stays 1.50 and yes stays yes, so the tree never turns text into a number or a yes/no value. Keys are shown without their quotes.
  • An anchor (&name) and a tag (such as !!str) appear as badges before the value. Comments are not shown in the tree.
  • An alias (*name) is shown as a reference row, *name → path, and is never expanded, so a value that is used many times is not repeated. A reference that points back to one of its own parents gets a “Cycle” badge. There is no jump to the target: read the path to find it.
  • There is no “Copy” or “Download” here, because the tool shows a tree and not a result text.

Good to know

  • These are refused, with no tree: syntax errors, with their line and column; a key repeated in one mapping; and an alias that has no anchor before it in its own document. Valid YAML that this tool does not support is refused too, and the message says that the syntax is valid: a custom tag, or a standard tag that does not fit its value, such as !!int abc; a directive (a line that starts with %); and a key that is not text (a number, true, false, null, an empty key, a key with an anchor, a tag or an alias, or a key written as a list or mapping). The tool never repairs YAML.
  • The path after an arrow joins keys and positions with dots, so a key that contains a dot makes it ambiguous: a.b can mean the key a.b or the key b inside a.
  • A value longer than 200 characters is cut off in the tree, and “Show full value” shows the whole value. An emoji counts as two characters in that limit.
  • The merge key << is shown as an ordinary key, with a warning, because YAML 1.2 Core has no merge keys.
  • A text with only comments or blank lines has nothing to show, so you get a note asking for content.
  • The limits count the whole text: the size limits add up all the documents, while the nesting limit applies to each document on its own.

How to use it

  1. Paste or type your YAML in the input box. It can hold one document or several, separated by ---. Nothing runs while you type.
  2. Press “View”. The “Tree” appears in the Result pane with the first level open.
  3. Click a row, or move with the arrow keys and press Enter, to open or close a branch. “Expand all” opens every branch and “Collapse all” closes them all.
  4. A long value is cut off in the tree. Press “Show full value” under it to read the whole value.
  5. If the YAML cannot be shown, the message says why and, when it can, where.

Examples

Anchors and aliases

Paste this YAML and press “View”. The tree is shown here fully open and simplified, without the counts and the badges; press “Expand all” to open everything yourself. The row settings: *defaults → defaults is a reference. It stands for the value anchored as &defaults and is not expanded, so a value used many times is not repeated. The text after the arrow is the path to the target.

defaults: &defaults
  retries: 3
  timeout: 30
service:
  settings: *defaults
  ports:
    - 8080
    - 8443

The YAML is shown as a tree.

{…}
  defaults: &defaults {…}
    retries: 3
    timeout: 30
  service: {…}
    settings: *defaults → defaults
    ports: […]
      0: 8080
      1: 8443

An alias without an anchor

The alias *bsae points to an anchor that does not exist, probably a typo for &base. YAML Viewer shows no tree for YAML that cannot be read, and the message points at the alias.

base: &base
  x: 1
copy: *bsae

This alias points to an anchor that does not exist. Define the anchor (&name) on a value or fix the name.

Line 3, column 7

The merge key <<

The key << is read as an ordinary key, because YAML 1.2 Core has no merge keys. Nothing is merged: adapter appears only under base, and the row <<: *base → base is a reference like any other. A warning reminds you that programs that apply YAML 1.1 merging can read this text differently.

base: &base
  adapter: postgres
dev:
  <<: *base
  database: dev_db

The YAML is shown as a tree.

This YAML uses << as an ordinary key. This tool follows the YAML 1.2 Core schema, which has no merge keys, so nothing is merged in. Programs that apply YAML 1.1 merging may read it differently.

{…}
  base: &base {…}
    adapter: postgres
  dev: {…}
    <<: *base → base
    database: dev_db

An alias that points back to its own parent

The alias *node sits inside the value anchored as &node, so following it would never end. YAML Viewer does not follow aliases: it shows the reference and marks the row with a “Cycle” badge, which the simplified tree below leaves out.

node: &node
  name: root
  self: *node

The YAML is shown as a tree.

{…}
  node: &node {…}
    name: root
    self: *node → node

More than one document

Paste this YAML and press “View”. The two documents are separated by ---. The tree starts with a list that has one row per document, numbered from 0: row 0 is the first document and row 1 is the second. A text with a single document is shown without that list.

service: api
ports: [80, 443]
---
service: web
ports: [8080]

The YAML is shown as a tree.

[…]
  0: {…}
    service: api
    ports: […]
      0: 80
      1: 443
  1: {…}
    service: web
    ports: […]
      0: 8080

Limits and privacy

Size limits

  • Input: up to 2,000,000 bytes of UTF-8 text (about 2 MB). Accented letters and emoji take more than one byte each. Larger input is rejected.
  • Nesting: up to 256 levels of mappings and lists inside each other. Deeper YAML is refused because it is beyond what the tool processes.
  • Values: up to 200,000 in one document. Each mapping, list, alias and single value such as a text or a number counts as one value, and keys do not count. A document with more is refused.
  • Tree rows: the tree shows up to 2,000 rows at first, and a button adds 2,000 more at a time, up to 10,000 rows shown at once. Collapse branches to make room for other rows.
  • Time: a run that takes longer than its time limit is stopped. Try a smaller input.

Your privacy

The text you type or paste, or open from a local file, is processed locally in your browser, in a dedicated Web Worker. It is never uploaded or sent to the server (a file you open is read in your browser only), and it is not written to storage, cookies or the address bar.

For the full details, see the Privacy Policy

Related tools and pages

Your text stays in the page when you switch tools in the same tab, so you can try the same text in another tool. Reloading or closing the tab ends it.

All tools