Skip to content

JSON to YAML

Convert JSON to YAML format.

Input
Output

No result

About JSON to YAML

This converts a JSON document into YAML, producing the block style familiar from configuration files: two-space indentation for nesting, a hyphen before each list item, and no braces or brackets anywhere. The data is unchanged; only the notation differs.

The reason to convert is readability in a context where a human will maintain the result. YAML drops the trailing commas and quotation marks that make JSON noisy to edit by hand, which is exactly why Kubernetes manifests, CI pipelines and application configuration files tend to be written in it rather than in JSON.

Empty containers keep their explicit form — an empty array becomes [] and an empty object becomes {} — so a structure that is deliberately empty remains distinguishable from one that merely has nothing in it yet.

How to use JSON to YAML

  1. 1 Paste the JSON document.
  2. 2 The YAML equivalent appears immediately, indented with two spaces.
  3. 3 Copy the output into your configuration file.

Frequently asked questions

Do I need to quote my strings in YAML?

Often not — plain words and numbers can be written unquoted, which is a large part of why YAML reads more cleanly. Values that could be misread as other types, such as the word "on" or a number with leading zeros, are safer quoted, so check those after converting.

How does it write an array in the YAML output?

Each element goes on its own line preceded by a hyphen, indented under its key. Nested arrays gain another level of indentation, so the structure stays visible without any brackets.

Will comments in my JSON survive?

JSON cannot contain comments, so there are none to carry across. If you need commentary in the YAML output, add it afterwards under the key it relates to.

Can I convert the YAML back to JSON again?

Yes, through the YAML to JSON tool. The data survives the round trip, though key order is preserved by this converter while a general YAML parser is not obliged to, so do not rely on ordering if the file will be processed elsewhere.

Free, online, and private

Free to use

JSON to YAML is completely free. There is no account to create, no login, and no hidden charge or usage limit.

Runs online in your browser

It is a free online tool that runs entirely in your browser. Nothing to download or install — open the page and start using it right away.

Your data stays private

All processing happens locally on your device. Your input is never uploaded, stored, or tracked, so it never leaves your browser.

How JSON to YAML behaves in detail

These are the specifics of this implementation — the exact ranges, defaults and fixed settings you are working with.

Parameter Value
Indent unit 2 spaces per nesting level
Array style block style with "- " at the current indent — flow style is never produced
Empty containers written as [] and {} on the line below the key rather than inline beside it
Scalars emitted through String() and never quoted
Key order the order the parser reports — keys are never sorted

Compiled from the implementation of this tool and checked against it by itoolnet.

What JSON to YAML does not do

Knowing the edges of a tool saves more time than another list of its features. These are the cases where it will not do what you might expect.

  • Strings are never quoted, so a value whose text is "yes", "true" or "123" is written bare and a YAML reader will type it as a boolean or a number — the fact that it started life as a string is lost.
  • A string containing a newline is written straight after the key, so a multi-line value breaks the indentation structure of the document instead of becoming a block scalar or a quoted string.
  • An empty array or object is placed on its own line under the key, so {"a":[]} comes out as a line reading "a:" followed by a line reading "[]", rather than the inline "a: []" form you would normally write.
  • Keys are emitted verbatim with no quoting and no escaping, so a key containing a colon, beginning with a dash or beginning with a hash sign produces a line that no longer parses as that key.
  • There is no anchor, alias or tag support and no way to choose flow style, so a document that relies on YAML references has to be written out in full — the conversion is one-way structural only.

Tested and documented by itoolnet, the team that builds and maintains this site.

Share & embed this tool

Writing a guide or article? You are welcome to link to JSON to YAML with the snippet below. It is free, runs entirely in your browser, and needs no signup.