Last updated ·Published ·By the WiserWork team

YAML Converter

Convert between YAML and JSON formats instantly

Copied to clipboard!

Converts in both directions: paste YAML to get formatted JSON, or switch tabs and paste JSON to get indented YAML back, with each tab carrying its own worked example.

What is the YAML Converter?

Two tabs, two directions. YAML to JSON runs a small hand-written line reader that uses indentation to work out nesting, handling keys, nested maps, and dash-prefixed lists of simple values, then prints the result as JSON with two-space indentation. JSON to YAML goes through the browser's own JSON parser, so that direction reports genuine syntax errors with a position, and writes the tree back out as indented YAML.

Key Features

  • Two tabs switch between YAML to JSON and JSON to YAML
  • Recognizes true, false, null and the tilde, and converts bare numbers
  • Strips surrounding single or double quotes from YAML string values
  • Skips blank lines and whole-line comments that begin with a hash
  • Reports JSON syntax errors with the position of the offending character

Common Use Cases

  • Turning a pipeline definition into JSON so a script can read it
  • Rewriting a JSON config as YAML for a tool that only accepts YAML
  • Checking what your indentation actually means before pushing a deploy
  • Getting a quick structural read on an unfamiliar manifest someone sent you

How to Use the YAML Converter

  1. Choose a direction with the YAML to JSON or JSON to YAML tab.
  2. Replace the sample in the left pane with your own document.
  3. Watch the right pane convert on every keystroke; no button press is needed.
  4. Press Convert to force a re-run after pasting, then Copy for the clipboard.
  5. Copy anything you want to keep before switching tabs, which reloads the sample.

Tips for Best Results

  • Quote your version numbers: an unquoted 1.10 is read as a number and becomes 1.1.
  • Quote leading zeros as well, or a zip code such as 01234 loses its zero.
  • Never indent with tabs; this reader counts a tab as one column and real YAML rejects them.
  • Stick to nested keys and lists of plain values, since lists of maps are not parsed.

Why Use WiserWork's YAML Converter?

YAML's design bet is that indentation should carry meaning, which makes a config file pleasant to read and unusually easy to break, since two spaces in the wrong place silently move a key into a different block. It is also why tabs are banned outright: a tab has no fixed width, so a mixed file would nest differently depending on whose editor opened it. Converting to JSON, where the braces are explicit, is the quickest way to see the structure a parser really built.

Who Uses the YAML Converter?

People who write pipeline definitions, container manifests and application config all day, and who mostly want to confirm what their indentation means. Developers also use the reverse direction to hand a JSON payload to a tool that reads nothing but YAML.

Frequently Asked Questions

Which direction does it convert?

Both. The tabs at the top switch between YAML to JSON and JSON to YAML, and each tab loads its own sample document so the shape of the output is visible before you paste anything.

Why do values like yes and no need quoting?

Under the YAML 1.1 spec, yes, no, on and off are booleans, which is why a country code of NO for Norway has caused so much grief over the years. This converter is stricter and only treats true and false as booleans, so no stays a string here even though your production parser may disagree. Quote them either way.

What happens to version numbers?

An unquoted 1.10 is read as a number and comes back as 1.1, quietly losing a digit that matters. A three-part version such as 1.2.3 is not numeric, so it survives as a string. Wrap versions in quotes before converting.

Why does YAML forbid tabs for indentation?

Because a tab's visual width is an editor setting rather than a fixed number of columns, a tab-indented file would nest differently for different people, so the specification bans them from indentation entirely. This converter counts a tab as a single column, which can silently drop a key into the wrong block.

Does it support lists of objects?

No. It handles dash-prefixed lists of simple values and nested maps under a key, but a sequence whose items are themselves maps is not converted correctly in either direction. Keep to config-shaped data: nested keys and lists of scalars.

Will it tell me if my YAML is invalid?

Not reliably. The YAML side is a line-by-line reader rather than a real parser, so badly structured input usually yields a strange object instead of an error. The JSON side is different, using the browser's own parser and reporting the exact position of a syntax error.

Are strings quoted in the YAML output?

No, and this is worth knowing before you use the result. Every string is written bare, so a JSON string of 10001 comes back as a value that a YAML parser will read as a number. Add quotes by hand to anything that must remain text.

Does it handle block scalars, anchors or multiple documents?

No. Multi-line block scalars, anchors and aliases, inline flow syntax written with brackets or braces, and document separators are all outside what this reader understands. It targets straightforward nested key and value configuration.

What does the Swap button do here?

It flips the conversion direction, which as a side effect reloads that tab's built-in sample into the input box. Copy your output first if you want to keep working with it.

Is my configuration file uploaded anywhere?

No. Both conversions are JavaScript running in the page, so a manifest full of internal hostnames or environment details stays on your machine.

YAML is easy to read and easy to get subtly wrong, and most of the wrongness lives in indentation and unquoted values. Round-tripping a file through JSON shows you the structure and the types a parser will really see.

Found this useful? Share it