YAML to JSON Converter

Paste YAML — a Compose file, Kubernetes manifest or CI config — and get formatted JSON. Syntax errors are reported with the exact line and column.

Runs in your browser
YAML indent
JSON indent
Open file

Both panes are editable — change either side and the other updates instantly.

Your data never leaves your computer. All processing happens 100% locally in your browser.

How to use the YAML to JSON

  1. Paste YAML into the YAML pane, open a .yaml/.yml file, or click Load sample.
  2. The JSON appears instantly. Choose 2-space, 4-space or tab indentation for the JSON output.
  3. If the YAML is invalid, the error message shows the line and column and highlights the spot.
  4. Click Copy or Download to save data.json.

What is YAML to JSON conversion?

YAML is designed for humans: indentation instead of braces, optional quotes and comments. JSON is designed for machines and APIs. Converting YAML to JSON lets you feed a config file to a tool or API that only speaks JSON, validate it against a JSON Schema, or simply check how a YAML parser actually interprets your indentation — which is the fastest way to find out why a value ended up in the wrong place.

What the converter supports

  • Anchors, aliases and merge keys — &defaults, *defaults and <<: *defaults (common in Docker Compose and GitLab CI) are expanded into plain JSON.
  • Multiple documents — files with several documents separated by --- (typical for Kubernetes) become a JSON array, one element per document.
  • Block scalars — | keeps line breaks, > folds them into spaces.
  • Comments are allowed in YAML but dropped in JSON, which has no comment syntax.

How values are typed (YAML 1.2)

The parser follows the YAML 1.2 core schema, the same rules as modern tools. Plain scalars become JSON types like this:

YAMLJSONNote
true, Falsetrue, falseBooleans
yes, on, NO"yes", "on", "NO"Strings in YAML 1.2 (booleans in old 1.1 parsers)
~, null, empty valuenull
0x1F, 0o17, 1e331, 15, 1000Numbers
2024-05-01"2024-05-01"Kept as a string
.inf, .nannullJSON has no infinity/NaN

Common YAML errors

Tabs for indentation are forbidden — use spaces. Inconsistent indentation (“bad indentation of a mapping entry”) happens when sibling keys don't line up. Unquoted colons — title: Note: read me — confuse the parser; wrap the value in quotes. Duplicate keys in the same mapping are reported as errors. Once converted, you can tidy the result with the JSON Formatter or generate types with JSON to TypeScript. For the reverse direction use JSON to YAML.

Tools that pair well with the YAML to JSON

  • CSV to JSON — Paste CSV or TSV and get a JSON array of objects.
  • JSON to CSV — Turn a JSON array into a spreadsheet-ready CSV.
  • JSON to Markdown Table — Turn API responses or LLM-generated JSON arrays into a clean, aligned Markdown table for READMEs, docs and pull requests.

Frequently asked questions

Does it support Docker Compose and Kubernetes files?
Yes. Anchors and << merge keys are resolved, and multi-document Kubernetes files separated by --- are returned as a JSON array.
Why is "yes" converted to a string and not true?
Under YAML 1.2, only true/false (in any capitalisation) are booleans. yes, no, on and off were booleans in YAML 1.1, which caused many bugs, so modern parsers treat them as strings.
What happens to YAML comments?
They are removed, because JSON has no comment syntax. If you need to keep notes, store them as regular string fields.
Can I use this as a YAML validator?
Yes. If the YAML cannot be parsed you get the error reason with line and column, plus a highlighted excerpt — the same checks a YAML linter performs for syntax.

Related tools