DataSwap Fast file & data format converters, no signup

JSON to YAML Converter

Paste JSON below to get readable YAML — nested objects and arrays indented in proper block style, and strings quoted only when they'd otherwise be ambiguous. Nothing you paste is uploaded; the conversion runs entirely in your browser.

Get YAML that reads like it was written by hand

Objects become key: value lines, indented 2 spaces per nesting level; when a value is itself an object or array, it moves to its own indented lines instead of staying inline. Arrays become a --prefixed block list at the same indent as the key that owns them — never a flow-style [a, b]. Strings only get wrapped in double quotes when leaving them bare would be genuinely ambiguous — empty, starting with a reserved character, containing : (a colon plus a space, which YAML would otherwise treat as its own separator), or matching a YAML keyword or number. Everything else stays bare for readability.

Worked example

Input:

{"name": "Alice", "age": 30, "active": true, "tags": ["a", "b"], "address": {"city": "Rome", "zip": "00100"}, "note": "value: with colon"}

converts to:

name: Alice
age: 30
active: true
tags:
- a
- b
address:
  city: Rome
  zip: "00100"
note: "value: with colon"

Notice tags becomes a proper indented list instead of staying inline, address becomes a nested mapping with city and zip indented under it, zip's value "00100" gets quoted because it would otherwise be read as a number, and note's value gets quoted because : with colon contains a colon-plus-space — exactly the sequence YAML uses to separate a key from its value.

Frequently asked questions

Why is my array shown as an indented list instead of [a, b]?

This converter always uses YAML's block style, not flow style — a `tags` array becomes a `-`-prefixed list on its own indented lines rather than an inline `[a, b]`. Block style is what most hand-written YAML (and most YAML tooling output) looks like, and it stays readable and diff-friendly even when the list is long.

Why are some of my strings wrapped in quotes and others not?

A string is quoted only when leaving it bare would be genuinely ambiguous: if it's empty, starts with a reserved character like `- ? : # & * ! | > ' " % @`, contains `: ` (a colon followed by a space, which YAML would otherwise read as its own key/value separator), or would be misread as a YAML keyword or number — the literal text "true", "false", "null", or something like "123" or "00100" that parses as a number. Everything else is left bare for readability, since unnecessary quoting just adds visual noise.

Does this validate my JSON before converting it?

Yes — parsing goes through JSON.parse, so invalid JSON shows the browser's own SyntaxError message instead of silently producing broken YAML. Fix the reported issue and the conversion runs automatically.

Is my JSON uploaded anywhere?

No. Parsing and YAML generation both happen in your browser — nothing you paste is sent to a server, stored, or logged. That's true for every tool on this site.

What happens to empty objects and empty arrays?

An empty object becomes `{}` and an empty array becomes `[]`, written inline on the same line as the key that owns them — exactly like JSON's own empty-container syntax, since there's nothing to list on separate lines.