gizmobench

YAML Formatter

Paste YAML to validate its structure and format it for review. Processing stays local in your browser, with errors kept next to the input so you can fix the exact line.

formatted8 lines
service:
  name: gizmobench
  port: 8080
  debug: "yes"
  tags:
    - b
    - a
retries: 3
Status
Valid
Problems
0
Documents
1
Schema
YAML 1.2 core
Indent
Keys
1 comment was counted and not carried over: the formatter re-prints the data it parsed.

Valid: no problems, 1 document, read as YAML 1.2 core.

The data this document resolves to

The data this document resolves to under the YAML 1.2 core schema, printed as JSON.

{
  "service": {
    "name": "gizmobench",
    "port": 8080,
    "debug": "yes",
    "tags": [
      "b",
      "a"
    ]
  },
  "retries": 3
}
  • Key defined twiceport at 2:1 and 4:1
    error at 4:1, first at 2:1
  • debug: yesYAML 1.2 core
    debug is the string "yes"
  • Anchor expanded past the budgetalias bomb
    stopped at 5:8, nothing parsed

The YAML this page reads

The reader here was written for this page rather than taken from a library, so the honest thing is to publish what it handles. The first list is what it reads. The second is what it reports by name instead of guessing at, which is the part a validator usually leaves you to find out.

Read

  • Block mappings and block sequences, nested to any depth this page reads
  • Compact sequence items (a mapping that starts on the dash line)
  • Flow collections: [1, 2] and {a: 1}, including empty and multi-line ones
  • Plain, single-quoted and double-quoted scalars, with the double-quoted escapes
  • Block scalars: | and >, with the - and + chomping indicators
  • Anchors, aliases and a counted expansion budget
  • Several documents in one file, separated by --- and ...
  • Comments, counted and kept out of the data
  • The core schema tags !!str, !!int, !!float, !!bool, !!null, !!map and !!seq
  • An explicit !!bool accepts the older yes, no, on and off spellings

Reported, not read

  • Merge keys: << is reported as a warning and left as an ordinary key, not merged
  • The explicit key form: a line that starts with ? is reported, not read
  • A quoted scalar spread over several lines: use a block scalar instead
  • Custom and language tags, including !!binary: reported by name, never resolved
  • %TAG directives and tag shorthands beyond the core set
  • Comments in format mode: the formatter re-prints the parsed data, so comments are counted and dropped
  • Timestamps, sexagesimals and the other YAML 1.1 types: they stay strings, which is what YAML 1.2 core says

Every problem this page can report

All 17 of them, each with the line and the column of what it found. A warning is a note about how something resolved and leaves the document valid; an error does not.

CodeKindWhat it means
tab-indenterrorA tab is used to indent a line. YAML never allows one.
bad-indenterrorA line does not line up with the block it is in.
bad-valueerrorA line is not a key and a value, or there is more after the value ends.
duplicate-keyerrorThe same key appears twice in one mapping. Both lines are named.
unclosed-quoteerrorA quoted scalar is not closed on its line.
bad-escapeerrorA double-quoted scalar carries an escape YAML does not define.
unclosed-flowerrorA [ or { is never closed.
flow-syntaxerrorA flow collection is missing a comma or a closing bracket.
explicit-keyerrorThe explicit key form, a line starting with ?, is not read here.
undefined-aliaserrorAn alias names an anchor that was never defined above it.
alias-budgeterrorAlias expansion passed the node budget, so nothing was parsed.
unsupported-tagerrorA tag outside the core schema is refused by name and never resolved.
tag-mismatcherrorA core tag does not fit its value, such as !!int on a word.
deptherrorNesting goes deeper than this page reads.
merge-keywarningThe merge key << is a YAML 1.1 extension and stays an ordinary key here.
directivewarningA directive line is noted; only %YAML is understood.
stoppederrorThe reader stopped early because it could not make progress.

Up to 500,000 characters in one pass, read here in your browser with nothing uploaded and no account. Nothing in the document is ever run or fetched: a tag is a string to the reader, a URL is a string, and alias expansion stops after 10,000 copied nodes. Nesting is read 100 levels deep, and the data panel prints the first 20,000 characters of the result. The mode, the two format options and the draft are kept in this browser alone, drafts up to 100,000 characters, and the Start over control above the tool forgets them.

Accuracy. Read by a YAML 1.2 core-schema parser written for this page, so yes and no are strings, only true and false are booleans, and every problem carries a line and a column. Alias expansion stops at a fixed budget rather than hanging the page, a tag outside the core set is refused by name, and the subset this parser reads is listed under the tool. Your document is read in this browser and nothing it names is ever fetched.

Common questions

Can I format YAML without uploading it?
Yes. Parsing and formatting happen locally in the browser.

Read by a YAML 1.2 core-schema parser written for this page, so yes and no are strings, only true and false are booleans, and every problem carries a line and a column. Alias expansion stops at a fixed budget rather than hanging the page, a tag outside the core set is refused by name, and the subset this parser reads is listed under the tool. Your document is read in this browser and nothing it names is ever fetched.