To convert JSON to YAML, paste the JSON on the left and hit Convert: nested objects become indented maps, arrays become dash lists, and quoting appears only where a plain scalar would be ambiguous. The engine is eemeli/yaml (the modern successor to js-yaml) compiled for the browser, so Kubernetes configs, GitHub Actions workflows, and docker-compose files come out exactly the way those tools expect. A sample conversion: a 397-byte JSON service config converts to a 274-byte YAML file, parses back equal to the original, and long prose lines fold at column 80 unless you turn folding off. Switch the toggle to go YAML → JSON, with line-and-column parse errors when the input is broken.

Converter

Indent
Ad
Line folding
Paste JSON (or load the sample) and hit Convert. Nothing leaves your browser.
Ad

JSON Types in YAML Output — Engine-Verified

JSON valueYAML outputWhy
"hello"helloPlain scalar — nothing ambiguous
"true story"true storyWhole-string match would be a boolean; a phrase never is
"a: b""a: b"colon-space is the key separator — must be quoted
3.14, 42, -73.14, 42, -7Numbers pass through unchanged
1e211e+21YAML's canonical exponent form
true / falsetrue / false1:1 mapping
nullnullExplicit null (also valid: ~)
""""Empty string can't be a plain scalar
[1, 2, 3]- 1 linesBlock sequence, one dash per item
{"a":{"b":"c"}}indented mapNesting becomes indentation
"line1\nline2"|- blockBlock scalar replaces \n escapes
"café ☕"raw UTF-8No \u escapes — YAML is Unicode-native

Every row is the actual output of the yaml 2.9 engine this page runs, not a paraphrase. The minimal-quoting behavior is the same serializer Ansible, Jest, and the AWS CDK use through this library.

How the Converter Works

JSON and YAML differ in surface, not in data model: both express null, booleans, numbers, strings, arrays, and objects. Converting is therefore two steps — parse to a real value, then serialize in the target syntax — and every subtle bug in naive converters comes from skipping the parse and rewriting text with regexes. This tool always round-trips through the data: JSON.parseYAML.stringify one way, YAML.parseJSON.stringify the other, on the eemeli/yaml engine loaded from a CDN and executed locally.

The options that matter

Indent changes nesting width (2 spaces is the Kubernetes and GitHub Actions convention; 4 is common in older configs). Line folding wraps long plain scalars at column 80 with a continuation indent — the 80-column habit comes from terminals and code review diffs — and can be turned off when every value must stay on one line, as some strict pipelines require. Both are passed straight to the serializer.

How to use it

A worked example

A service config in JSON: a name, a replica count, a nested metrics block with enabled and interval_sec, a two-port array, a null timeout, and an environments list of two objects. In JSON that's 397 bytes over 25 lines. Converted at 2-space indent it becomes 274 bytes of YAML over 16 lines — the ports collapse into dash items, the environments entries read as clean stanzas, and the null stays explicit. Parsing that YAML back yields a value deep-equal to the original JSON object, which the tool verifies on every run rather than assuming. Folding shows up on prose: a 164-character description string wraps into three folded lines at column 80 by default and stays on one line with folding off.

Frequently Asked Questions

How do I convert JSON to YAML online?

Paste your JSON into the converter and it parses and re-serializes it as YAML entirely in your browser — no upload to any server. The conversion preserves nested objects, arrays, and scalar types exactly. Invalid JSON is flagged with a parse error so you can fix it before converting.

Is YAML always more compact than JSON?

Usually yes, because YAML drops quotes, braces, and commas in favor of indentation, but not always. Very short values, deeply nested single-item arrays, and strings containing special characters can make YAML as long or longer than JSON. YAML also permits multiple equivalent renderings (flow vs block style) of the same data.

What JSON features have no clean YAML equivalent?

Everything in JSON maps to YAML cleanly except duplicate keys and certain edge-case numbers like leading-plus exponents, which YAML parsers may reject or normalize differently. YAML 1.1 vs 1.2 spec differences can also change how things like booleans (on/off/yes/no) are typed on round-trip. For config files this rarely matters, but strict round-tripping is not guaranteed.