JSON to YAML Converter

Convert a JSON document into readable, properly indented YAML without sending anything to a server. The output is the shape you actually want in a GitHub Actions workflow, a Kubernetes manifest or a Docker Compose file, and any value that would change meaning when it is read back as YAML is quoted.

JSON input

YAML output


            
            

Ready — paste some input or load the sample.

100% Client-Side · Privacy First. This tool runs entirely inside your browser. Nothing you type is uploaded, logged or sent to a server — you can even use it offline.

Overview

JSON and YAML describe the same data in two different dialects. JSON is strict: double quotes, no comments, no trailing commas, and only one way to write a key. YAML is lenient: plain scalars, comments, anchors, multi-line strings and several ways to write the same value. The conversion from JSON to YAML is therefore mostly a matter of removing the quotes that are no longer needed and choosing an indentation style, but the interesting part is knowing when the quotes must stay. A string such as yes, no, on, off, true or null has to keep them, otherwise YAML reads it as a boolean or a null. A string that starts with a hash, a dash or a space needs them too, as does one that looks like a number. This converter applies those rules, so the YAML it produces means the same thing as the JSON you started with rather than silently turning a version string into a float. Nested objects and arrays keep a consistent two-space indentation, and empty collections become the explicit {} and [] forms.

How to use the json to yaml converter

  1. 1Paste your JSON into the input panel.
  2. 2Read the YAML in the output panel and check the shape against what you expected.
  3. 3Look at the notes for the number of top level keys, which is a quick way to spot a truncated paste.
  4. 4Copy the YAML into your configuration file or into a pipeline step.
  5. 5Use the YAML to JSON converter afterwards when you want to confirm that the round trip preserves the data.
  6. 6Mind the YAML values that read as booleans — yes, no, on and off — and quote them if your parser would misread them.

Cheat sheet

The syntax you will use most, and what each part does.

PatternWhat it means
{"name":"app"} Becomes name: app, because a plain scalar does not need quotes in YAML.
{"version":"1.0"} Becomes version: "1.0" — a quoted string, because an unquoted 1.0 would be a number.
{"enabled":"yes"} Becomes enabled: "yes", because YAML would otherwise read yes as a boolean.
{"list":[1,2]} Becomes a block sequence with a dash in front of each item.
{"empty":{}} Becomes empty: {}, the explicit flow form for an empty mapping.
{"empty":[]} Becomes empty: [], the explicit flow form for an empty sequence.

Common mistakes

A version number becomes a number.

The converter quotes any string that looks numeric, so 1.0 stays a string and survives the round trip back to JSON.

A yes or no value becomes a boolean.

YAML 1.1 treats yes, no, on and off as booleans. Such strings are quoted on the way out, and the decoder treats them as strings too.

A key with a colon breaks the file.

A key or value containing a colon followed by a space needs quoting, and the converter quotes it automatically.

The order of the keys changes.

Both formats preserve insertion order for object keys, so the order you see in the JSON is the order you see in the YAML.

Worked examples

A nested configuration

{"a":1,"b":[1,2],"c":{"d":"e"},"n":null}

YAML with a nested mapping, a block sequence and an explicit null value.

Values that need quoting

{"version":"1.0","enabled":"yes","url":"https://x.dev/a?b=1"}

The version and the flag stay quoted strings, and the URL is quoted because of its colon.

Frequently asked questions

Does the conversion preserve the data exactly?

The values do. Every string stays a string, every number keeps its value, and the nesting and the key order are preserved. What cannot survive is the distinction between a number and a numeric string, because YAML has a single syntax for both.

Why are some values quoted and others not?

A value is quoted whenever leaving it unquoted would change how a YAML parser reads it: a version like 1.0, a word such as yes or no, a string that starts with a special character, or anything that contains a colon followed by a space.

Can it handle very large documents?

A few hundred kilobytes is comfortable in a browser tab. Beyond that the JSON parse, the tree walk and the rendering all happen at once, so a script on the command line is the better choice for very large files.

Is the output using two space indentation?

Yes, two spaces per level, which is the convention that every YAML linter and every Kubernetes manifest expects.

What happens to an empty object or an empty array?

They are written as {} and [] on a single line, which is valid YAML and keeps the structure obvious instead of emitting an empty block that a parser would read as null.

How are null values represented?

As null, and as an empty value when it sits on a line of its own. Both forms are read back as null by a standard parser.

Does the order of the keys change?

No. The output follows the order of the JSON document, so a diff between the source and the generated file stays readable and a review of a configuration change is easy.

When should I prefer YAML over JSON in a config file?

YAML is friendlier for a human who has to edit the file, because it supports comments and reads without braces. JSON is better when a program parses the file, or when the value travels over the network.

Does it convert a JSON array?

Yes, an array becomes a YAML sequence, with a dash in front of every item and the nesting kept at the right indentation.

How are very large or very small numbers written?

A number is written the way JavaScript prints it, which keeps the value readable. A value that came from a database as a big integer may need to be quoted, because YAML would otherwise read it as a float.

Is the output safe to paste into a GitHub Action?

Yes, it is ordinary YAML with two space indentation and quoted values where the meaning would otherwise change. It is worth running it through a linter once if the pipeline is important to you.