Skip to content
DoItJag

JSON to YAML Converter

Turn JSON into YAML for configuration files, Kubernetes manifests or documentation, keeping every value and type exactly the same.

or drop a file here · .json, .txt · up to 20 MB

Options

About the JSON to YAML Converter

JSON is precise but noisy, with quotes and brackets everywhere. YAML shows the same data through indentation, which is why Kubernetes, Ansible and CI pipelines use it for configuration. This converter produces YAML that means exactly the same as your JSON.

When to use it

  • You have an API response or exported settings in JSON and want a readable config file.
  • A tool printed a Kubernetes object as JSON and you want to keep it as a YAML manifest.

Worked example

Select Try an example, keep 2 spaces and choose Convert to YAML. The catalog key holds a book list, and each book starts with a dash. Notice that the “@id” key is written in double quotes: an unquoted @ at the start is not allowed in YAML. The tags array becomes a nested list, one value per line.

Keeping types the same

The trickiest part of YAML is that unquoted text can change type. The converter quotes a string whenever leaving it bare would change its meaning:

  • “123” stays a string, written “123”, rather than becoming a number.
  • “true”, “false” and “null” as strings are quoted for the same reason.
  • Text that would otherwise look like a key, a list item or a comment is quoted.
  • Words such as yes and no are left unquoted, because YAML 1.2 reads them as text. If an old YAML 1.1 tool will read the file, check those values.

Large integers such as 12345678901234567890 are written with every digit; nothing is rounded.

What you will not see

  • Anchors and aliases are not created, even when values repeat. Each value is written in full, which is safest for tools that treat aliases differently.

Good to know

  • The JSON must be valid; errors show their line and column.
  • To go the other way, use YAML to JSON. To tidy an existing YAML file, use the YAML formatter.

How to use JSON to YAML Converter

  1. Paste JSON or open a .json file.
  2. Choose 2 or 4 spaces.
  3. Select Convert to YAML, check the result, then copy or download it.

Privacy: how it works

Everything happens in your browser. Your text is not sent to any server.

Frequently asked questions

Why are some strings in quotes?

A string such as "123", "true" or "null" would be read back as a number, boolean or null if written without quotes. Quoting keeps it a string.

Are large numbers kept exactly?

Yes. A number such as 12345678901234567890 is written with all its digits; it is not rounded.

Does the JSON have to be valid?

Yes. If it is not, you see the line and column of the first error. The JSON validator gives a fuller explanation.