Skip to content
Toolew.com

JSON to YAML Converter

Convert JSON into clean, readable YAML with control over indentation, quoting, line folding, key order and multi-document output.

Runs in your browser. Your data is not uploaded.
Loading tool…

This guide is not yet available in your language and is shown in English.

Tool guide

What this tool does

JSON to YAML Converter rewrites JSON as block-style YAML for configuration files, Kubernetes manifests, CI pipelines and documentation. Choose 2 or 4 space indentation, quoting style and line width, sort keys, and split a top-level array into separate YAML documents. Strings such as "yes" or "1.0" are quoted automatically so they keep their meaning.

Many tools speak YAML for configuration, including Kubernetes, Docker Compose, GitHub Actions, Ansible and OpenAPI, while the data you start with often comes from an API or a generator as JSON. YAML drops the braces and most quotes, which makes it much easier to read and review, but it also has traps: the string "yes", the version 1.10 or a value starting with * can change meaning if it is written without quotes.

This converter uses js-yaml to produce block-style YAML and quotes any string that would otherwise be read as a number, boolean, null or special syntax. You choose the indentation, whether list items are indented under their key, the quote character and whether long strings are folded at 80 or 120 characters. Because every JSON document is valid YAML 1.2 content, the conversion is lossless. Your data is processed locally in the browser.

How to use JSON to YAML Converter

  1. Paste JSON into JSON input or open a file; comments and trailing commas are accepted.
  2. Choose Indentation and whether list items should be indented under their parent key.
  3. Pick a Line width for long strings, or Never fold to keep each value on one line.
  4. Select the Quote style, and switch on Quote all string values if your team prefers explicit quotes.
  5. Optionally sort keys, add a leading --- marker, or write a top-level array as separate documents.
  6. Copy the YAML or download data.yaml; use batch mode for several files.

Tips for better results

  • For Kubernetes, convert a JSON array of resources with Top-level array as separate documents to get one manifest per resource separated by ---.
  • Keep 2-space indentation for Kubernetes and GitHub Actions, which is the convention in their documentation.
  • Multi-line strings are written as literal blocks (|), which keeps scripts and certificates readable.
  • Use YAML to JSON afterwards to round-trip the file and confirm nothing changed.

Common use cases

  • Turning kubectl get -o json output into a manifest you can edit and commit.
  • Converting an OpenAPI or JSON Schema document to YAML for easier review.
  • Writing CI pipeline or Docker Compose files from generated JSON.
  • Making configuration readable in documentation and pull requests.

Common mistakes to avoid

  • Hand-editing the output with tabs: YAML indentation must use spaces only.
  • Removing quotes the converter added around values like "on", "no" or "0755"; YAML 1.1 tools would read them as booleans or octal numbers.
  • Assuming key order is meaningful after enabling Sort keys; most tools ignore order, but humans reviewing a manifest may expect apiVersion and kind first.

Frequently asked questions

Is every JSON file valid YAML?

Practically yes: YAML 1.2 was designed as a superset of JSON. Converting to block style changes only the layout, not the data, so it can be converted back without loss.

Why are some strings quoted and others not?

Plain YAML strings must not look like another type. Values such as "true", "null", "1.0", "yes" or ones starting with special characters like * or & are quoted so that YAML parsers read them as text.

Can I create multiple YAML documents?

Yes. If the JSON is an array and Top-level array as separate documents is on, each item becomes its own document separated by ---, the format kubectl apply accepts.

Are comments preserved?

JSON has no comments, so there are none to keep. If you paste JSONC with comments, they are accepted on input but cannot be carried into the YAML.

Feedback & suggestions

Help us improve JSON to YAML Converter. We read every message.

Rating (optional)
Necessary
Required for security, language and theme preferences. Always on.