YAML to JSON Converter

Paste YAML to get formatted JSON, or paste JSON to get readable YAML. The converter understands nested maps and lists, quoted and multi-line strings, comments, inline lists like [a, b] and several documents in one file, and it points to the line where a mistake is. Use it for config files, deployment settings, API specs and data you need to move between tools.

What you enter

What you get

How it works

  1. Choose YAML to JSON or JSON to YAML.
  2. Paste your text. A YAML mistake is reported with its line number, such as a duplicate key or a tab used for indentation.
  3. Pick the indent size, 2 or 4 spaces.
  4. Copy the converted result or download it as a file.

How YAML and JSON relate

JSON is strict and compact: braces, brackets, quotes and commas everywhere. YAML describes the same kinds of data with indentation instead, and allows comments, which is why it is popular for configuration files that people edit by hand. Nearly every JSON document is also valid YAML, so converting from JSON to YAML only changes how the data is written, never what it means.

The reverse is not always lossless. YAML can hold comments, anchors and several documents, and JSON cannot, so comments are dropped and a multi-document file becomes an array. The data itself, the maps, lists, strings, numbers, booleans and nulls, converts exactly.

Mistakes that change meaning without an error

The famous trap is the unquoted value that turns into something else. A country code like NO can be read as the boolean false by YAML 1.1 parsers, a version like 1.10 is a number and loses its zero, and a time like 12:30 can be read as a number of minutes. This converter follows the common YAML 1.2 rules, where only true and false are booleans, but the safest habit is to quote values that must be text.

Indentation is the second source of surprises. A key indented one space too far or too little changes the nesting without any warning from the language, and a list placed at the wrong depth belongs to a different key. When you convert to JSON, check the shape of the result: the braces and brackets make the nesting you actually wrote visible at a glance.

Tips

Frequently asked questions

How do I convert YAML to JSON?

Paste the YAML and keep YAML to JSON selected. Maps become JSON objects, dashed lists become arrays, and plain values become strings, numbers, true, false or null. For example, a line port: 8080 becomes "port": 8080.

Which YAML features are supported?

Nested maps and lists, plain, single-quoted and double-quoted strings with escapes, multi-line plain and quoted strings, block strings with | and > including the - and + options, inline lists and maps, comments, and several documents separated by ---. Anchors, aliases, tags and complex keys are reported as unsupported.

What happens with several YAML documents in one file?

If the text holds more than one document, separated by lines of ---, the JSON result is an array with one entry for each document. A single document gives a single value.

How is JSON turned into YAML?

Objects become key: value lines, arrays become dashed lists, and strings are quoted only when they have to be, for example when they look like a number, a boolean or null, are empty, or contain a colon and a space. Multi-line strings are written as block strings with |.

Is my data uploaded?

No. Parsing and conversion run in your browser, so config files containing internal names or settings stay on your device.

Related: JSON formatter, XML to JSON converter, JSON to CSV converter.

Start for free or see all free tools. We.Inc is free to start, with no card needed. AI building is on paid plans from $20 a month.

More in Free Tools

We.Inc is an AI-powered website builder you can resell under your own brand. Launch a branded client dashboard, bill on Stripe Connect, and deliver AI-generated websites in minutes. White-label plans start at $99 a month for 25 client sites, with a 7-day free trial and no per-site fees.

Product

Who It's For

Features

Resources

Company

View Sitemap