Skip to content

Developer Tools

YAML Converter

Paste YAML to get formatted JSON, handy for config files and API payloads. Conversion runs in one direction, from YAML to JSON.

  • Free
  • No sign-up
  • Runs in your browser

Guide

How YAML relates to JSON

YAML is a human-friendly data format built around indentation. A mapping is written as key: value lines, a list is written with a dash at the start of each item, and nesting is shown by how far a line is indented. It also allows comments, which JSON does not.

JSON describes the same kinds of data (objects, arrays, strings, numbers, booleans and null) but uses braces, brackets, quotes and commas. In fact most JSON is also valid YAML. Because the two formats share the same data model, a document can usually be moved from one to the other without losing information, as long as it does not rely on YAML-only features like comments or anchors.

Why you would convert YAML to JSON

Configuration files for containers, CI pipelines, Kubernetes and many frameworks are written in YAML because it is easy to edit by hand. Tools, scripts and APIs, on the other hand, usually expect JSON. Converting lets you feed a YAML config into something that only accepts JSON, or look at how a YAML file is really parsed.

It is also a good debugging step. YAML is sensitive to indentation, and a value that looks like a string to you may be read as a number or boolean. Seeing the JSON result shows exactly what a parser understood: whether a list is really a list, whether a value is quoted, and whether a key landed at the level you intended. Once you have JSON, the JSON Formatter or the JSON Validator can help you check it further.

How to use this converter

  1. Paste your YAML into the YAML box. It starts with a small example (a name, a boolean and a list of tags).
  2. The JSON box below updates automatically as you type, formatted with two-space indentation.
  3. If the YAML cannot be parsed, an error message from the parser appears instead of output. Fix the indicated problem and the result returns.
  4. Click Copy to copy the JSON.

The page on this site converts in one direction only: YAML in, JSON out. Parsing is done with a YAML library loaded into your browser, and your text is not uploaded anywhere. There is no download button.

Pitfalls when converting

Indentation must use spaces, not tabs, and sibling items must line up exactly. The most common error is a list or key indented one space off from its neighbors.

Watch for values YAML interprets on its own. Unquoted words like yes, no or true may become booleans, an unquoted 010 or 1.0 may become a number, and an empty value becomes null. If you need text kept as text, put quotes around it in the YAML. Check the JSON output to confirm the types are what you expect.

Comments in the YAML are dropped because JSON has no place for them. If your file contains several documents separated by three dashes, the parser used here expects a single document, so convert them one at a time. Spreadsheet-style data is a different problem, and for that the CSV to JSON tool is the better fit.

Frequently asked questions

Can this tool turn JSON into YAML?

Not on this page. It is set up for YAML to JSON only. Since JSON is nearly a subset of YAML, many JSON documents can be pasted straight into a YAML file anyway.

Why did my YAML comments disappear?

JSON has no comment syntax, so comments are discarded when the YAML is parsed into data. Keep the original YAML if you want to retain them.

Why is a value showing up as a number or true instead of text?

YAML decides types from how a value looks. Put quotes around the value in your YAML, such as "010" or "yes", to keep it as a string.

Is my configuration sent to a server?

No. The conversion runs in your browser, so the text stays on your device. Still, avoid pasting real secrets into any tool you do not need to.