JSON to YAML — Free

Convert JSON to YAML with a hand-written serializer, or parse YAML back to JSON. Handles nesting, arrays, quotes and multiline strings — free, no signup.

JSON to YAML Converter — free online, no signup

Loading the tool… (requires JavaScript)

What is the JSON to YAML Converter?

JSON and YAML are the two great configuration formats of modern development: JSON for APIs and data exchange, YAML for human-written config files like Docker Compose, GitHub Actions and Kubernetes manifests. This free converter translates in both directions — JSON to YAML with a hand-written serializer, and YAML back to JSON with a matching parser — so you can move between the two without installing anything.

The JSON to YAML direction handles everything real configs throw at it: nested objects, arrays of objects, empty collections, and strings that need quoting — values containing colons, leading dashes or words like true and null are automatically quoted so the YAML stays valid. Multiline strings become clean block scalars, keeping long descriptions readable instead of escaped onto one line.

The reverse direction parses YAML back into pretty-printed JSON, which is perfect for validating a config file you wrote by hand or feeding YAML data into a JSON-only tool. The parser understands nested maps, sequences, quoted strings, numbers, booleans, nulls and block scalars, and reports exactly which line breaks if your YAML is malformed.

Both directions run on pure JavaScript written for this tool — no heavy library, no server round-trip. Your configuration data, API keys and infrastructure details never leave your browser, which is exactly what you want when converting files that contain secrets. No signup, no limits, just paste and convert.

YAML's readability comes with sharp edges that bite everyone eventually, so a few rules will save you debugging hours. Never use tabs for indentation — YAML forbids them outright and the error messages are famously unhelpful; two spaces per level is the universal convention. Strings that look like other types are the classic trap: yes, no, on and off parse as booleans in YAML 1.1, and unquoted version numbers like 3.10 become the float 3.1, which is why this converter quotes ambiguous values automatically. Colons inside plain strings need a following space to be safe, and the # character starts a comment unless it is inside quotes. Anchors and aliases (&name and *name) let you reuse blocks without duplication in large configs, though they are an advanced feature worth learning once your files grow. When in doubt, convert your YAML back to JSON with this tool — the strict JSON output exposes structural mistakes that are easy to miss in the YAML itself. Convert with confidence, validate the result, and your configs will deploy without surprises.

How to use it

  1. Choose the direction — Select JSON to YAML or YAML to JSON from the dropdown, depending on what you are starting with.
  2. Paste your input — Paste valid JSON for the forward direction, or YAML for the reverse direction.
  3. Press Convert — The tool serialises or parses your input and shows the result with clear error messages if something is wrong.
  4. Copy the result — Use the Copy button to grab the output for your config file, API payload or documentation.
  5. Round-trip to verify — Convert back the other way to confirm nothing was lost — the pair is designed to round-trip cleanly.

Common use cases

  • Turning API JSON responses into YAML config files
  • Writing Docker Compose or CI configs from JSON snippets
  • Validating hand-written YAML by converting it to JSON
  • Preparing data for tools that only accept one of the two formats
  • Learning YAML syntax by watching how JSON structures translate

Tips

  • YAML is indentation-sensitive — the output uses 2 spaces per level, the standard.
  • Quote-looking values like "007" or "yes" are auto-quoted to preserve their string type.
  • Very large files convert fine, but keep secrets out of any online tool out of habit.
  • Tabs are not valid YAML indentation — convert any tabs to spaces first.
  • Use the reverse direction as a quick YAML linter before committing config files.

Frequently asked questions

How do I convert JSON to YAML?

Paste your JSON into this converter with JSON to YAML selected and press Convert. Nested objects, arrays and tricky strings are serialised into clean, valid YAML you can copy straight into config files.

Can I convert YAML back to JSON?

Yes — switch the direction to YAML to JSON. The built-in parser handles nested maps, lists, quoted strings, numbers, booleans and block scalars, and shows you pretty-printed JSON.

What is YAML used for?

YAML is a human-readable data format widely used for configuration files: Docker Compose, Kubernetes manifests, GitHub Actions workflows, Ansible playbooks and many app settings files.

Is it safe to paste config files with secrets here?

The conversion runs entirely in your browser — nothing is uploaded or stored. That said, it is good practice to minimise exposure of real secrets anywhere outside your own systems.

Related tools