JSON to YAML Converter

Convert JSON objects and arrays into clean, indented YAML for config files, CI pipelines, Kubernetes manifests, and Docker Compose. Conversion runs entirely in your browser — paste JSON, get YAML, and copy or download the result.

Quick answer

A JSON-to-YAML converter rewrites JSON's brace-and-bracket structure as YAML's indentation-based block style: objects become mappings, arrays become - sequences, and scalars carry over. This tool uses 2-space indentation, quotes every string (which safely avoids YAML's type-coercion traps), and leaves numbers, booleans, and null unquoted — all in your browser, nothing uploaded. Paste JSON, click Convert to YAML, then copy or download.

How This Tool Converts JSON to YAML

When to Use JSON to YAML

Worked example

A small config object with a nested object, an array, and mixed value types:

Input JSON

{
  "name": "web",
  "replicas": 3,
  "active": true,
  "skills": ["JS", "Python"],
  "address": { "city": "Boston" }
}

Output YAML

name: "web"
replicas: 3
active: true
skills:
  - "JS"
  - "Python"
address:
  city: "Boston"

What happened

Edge cases & gotchas

Frequently Asked Questions

Does this tool preserve JSON data?

Yes. It converts JSON structure to YAML while keeping the same keys and values.

Can I convert nested arrays and objects?

Yes. Nested JSON objects are represented using YAML indentation for readability.

Can I move back to JSON?

Yes. Use the YAML to JSON Converter to reverse the conversion, or paste directly into the JSON Formatter.

Are strings automatically quoted in the output?

Yes. Every string value is emitted with double quotes, while numbers, booleans, and null are left unquoted. Quoting all strings is deliberately safe — it prevents YAML from re-interpreting string values as other types. Keys are not quoted.

Why does quoting strings matter in YAML (the Norway problem)?

YAML 1.1 coerces several unquoted words into booleans — no, off, and n become false, while yes, on, and y become true. The classic example is a list of country codes where NO (Norway) silently turns into the boolean false. Unquoted version numbers like 1.10 also become the float 1.1, and values like 08 can error as an invalid octal. Because this converter quotes every string, values like "no", "1.10", and "08" stay strings and avoid all of these traps.

Isn't JSON already valid YAML?

Yes — YAML is a superset of JSON, so any valid JSON document is technically also valid YAML and most YAML parsers will accept it as-is. The reason to convert is readability and idiom: tools like Kubernetes, Docker Compose, and Ansible expect the indentation-based block style, not JSON's braces, and reviewers expect to see it that way in config files.

Does the YAML output use 2-space or 4-space indentation?

The output uses 2-space indentation, which is the most common convention for YAML files used in Docker Compose, Kubernetes, and GitHub Actions.