JSON to YAML Converter

Paste JSON to turn it into clean, readable YAML, or switch the direction to turn YAML back into JSON. The tool checks your input as you type and points at the exact line and column when something is wrong. Everything runs in your browser, so your data stays on your device.

Paste or type JSON to convert it
Indent
Result (YAML)

What the JSON to YAML converter does

JSON and YAML are two ways to write the same data. JSON uses braces and brackets and is what most APIs and programs read. YAML uses indentation instead of braces, which makes it easier for people to read and is why it is used for config files in Docker, Kubernetes, and GitHub Actions. This converter reads one format and writes the other with the same keys, values, and nesting, so you can move between a machine friendly JSON payload and a human friendly YAML config in seconds.

Why use our JSON to YAML converter

  • ·Free. No signup, no paywall, no limits.
  • ·Runs in your browser. Your data is never uploaded, so it is safe for private config.
  • ·Both directions. Convert JSON to YAML and YAML to JSON in the same place, with a one click swap.
  • ·Live validation. See if your input is valid as you type, with the exact line and column of any error.
  • ·Your choice of indent. Use 2 or 4 spaces, and sort keys when you want them in order.

JSON to YAML conversion options

Direction

Switch between JSON to YAML and YAML to JSON. When you switch, the current result moves into the input box, so you can convert straight back the other way.

BeforeJSON to YAMLAfterYAML to JSON

Indent

Choose 2 or 4 spaces for each level of nesting. Both JSON and YAML use spaces, so the result stays valid either way and matches your project's style.

Beforea: - 1 - 2Aftera: - 1 - 2

Sort keys A to Z

Puts the keys of every object or mapping in alphabetical order, all the way down. List order is left alone, since the position of items in a list has meaning.

Beforename: pear age: 2Afterage: 2 name: pear

Live validation

The status bar checks your input as you type and points at the exact line and column of any error, so you fix the source before converting.

Beforekey: [unclosedAfterError on line 1

What changes when you convert between JSON and YAML

The data stays the same, but a few things do not survive the trip. Each of these was checked with this converter:

GoingWhat happens
JSON to YAMLText that looks like a number keeps its quotes, so "1.10" and "01234" stay text. Values with a colon, like "a: b", are quoted too.
JSON to YAMLThe text "yes" is written as answer: yes without quotes. That is correct YAML 1.2, but an older YAML 1.1 tool would read it as true. Quote it by hand if your tool is old.
YAML to JSONComments are dropped, since JSON has no comments.
YAML to JSONAnchors and aliases (&base and *base) are expanded, so the shared block is copied into every place that used it.
YAML to JSONMerge keys like <<: *defaults, common in Docker Compose and GitLab CI files, are not merged. They come out as a key literally named "<<", so check those files by hand.

Key order is kept in both directions unless you turn on Sort keys, so a converted file lines up with the original when you compare them.

When to convert JSON to YAML

JSON and YAML each have their place, and moving between them comes up often. Here are the most common reasons:

  • ·Writing a config file. Turn a JSON example from the docs into the YAML a tool like Docker Compose or Kubernetes expects.
  • ·Reading an API response. Convert a JSON payload to YAML to skim its structure more easily.
  • ·Feeding a tool that wants JSON. Turn a YAML config into JSON for a program or API that only accepts JSON.
  • ·Checking a config before you commit. Validate YAML and see it as JSON to be sure the structure is right.
  • ·Comparing two files. Sort the keys of both so the same fields line up and the real differences stand out.

Frequently asked questions

How do I convert JSON to YAML?
Paste your JSON into the input box and keep the direction on JSON to YAML. The tool checks the JSON as you type and shows a green message when it is valid. Pick your indentation, then click Convert to YAML. The YAML appears below, ready to copy or download as a .yaml file.
How do I convert YAML to JSON?
Switch the direction to YAML to JSON and paste your YAML. The tool validates the YAML and points at any error, then converts it to JSON with your chosen indentation when you click Convert to JSON.
Does the conversion change my data?
No. JSON and YAML describe the same kinds of data, so the keys, values, lists, and nesting all carry across unchanged. Only the format and spacing differ. Turning on Sort keys reorders object keys alphabetically, which both formats treat as the same data.
Why do people convert between JSON and YAML?
YAML is easier for people to read and write, so it is popular for config files in tools like Docker Compose, Kubernetes, and GitHub Actions. JSON is what most APIs and programs expect. Converting lets you write config in YAML and hand JSON to a tool that needs it, or read a JSON payload as clean, readable YAML.
What if my YAML is invalid?
The status bar shows the line and column where the parser stopped, along with a short message. YAML is sensitive to indentation, so most errors come from tabs, uneven spacing, or a missing space after a colon. Fix the input and the tool converts it.
Can it handle comments in YAML?
JSON has no place to store comments, so converting YAML to JSON drops them, the same as any converter. The keys, values, and structure all carry across. If you need the comments, keep a copy of the original YAML.
Is my data kept private?
Yes. All converting and validating runs in your browser. Your JSON and YAML are never uploaded to a server or saved anywhere, so you can safely paste in config that contains private values. Once the page has loaded you can even use it offline.