JSON ↔ YAML Converter
Convert JSON to YAML and YAML to JSON. Validate JSON, format pretty/compact, YAML indent 2/4. Drag-drop files. Copy/download. 100% offline.
About this tool
A focused JSON ↔ YAML converter. The JSON → YAML direction serializes any JSON document into clean, idiomatic YAML: strings get quoted only when needed (no unnecessary "" around simple identifiers), indentation is configurable (2 or 4 spaces), and nested structures use proper block style. The YAML → JSON direction parses common YAML 1.2 syntax: mappings, sequences, nested blocks, quoted strings, booleans, nulls, numbers, and block scalars (literal | and folded >). The input area shows a live status line — green dot for valid, red dot for parse error with the first line of the error message. Drag-drop a .json or .yaml file onto the dropzone to load it; the direction is auto-switched based on extension. The swap button moves the output to the input and flips direction in one click — useful for round-trip checking. Compact JSON toggle for the YAML → JSON direction produces a single-line result, useful for config files and API payloads. Everything runs locally — no js-yaml CDN, no server round-trip.
Details
- Category
- developer
- Version
- 1.0.0
- Size
- 14 KB
- Updated
- Jun 2026
Frequently Asked Questions
Does it support the full YAML 1.2 spec?
It supports the most common subset used in config files: mappings, sequences, nested blocks, quoted strings (single and double), booleans, nulls, numbers, and block scalars (literal | and folded >). It does NOT support anchors and aliases (& and *), tags (!!str, !!int), flow style ({a: 1} and [1, 2]), multi-document streams (--- separators), or custom types. For full YAML 1.2, use a dedicated library — this tool is sized for human-edited config files and Kubernetes manifests.
Why use YAML over JSON?
YAML is more compact (no curly braces or commas), allows comments (#), and treats indentation as syntax (so structure is visible at a glance). Common use cases: Kubernetes manifests, Docker Compose, GitHub Actions workflows, Ansible playbooks, and any human-edited config file. JSON is more universal as a wire format — APIs almost always speak JSON, while YAML is mostly for files.
Are quoted strings preserved on round-trip?
Yes. Strings that need quoting (because they contain a colon, hash, special characters, or look like numbers/booleans) are quoted in the YAML output, and the parser reads them back identically. Simple identifier-like strings ("hello", "version") are emitted without quotes, and parsed back as strings. The only loss is whitespace differences — for example, trailing whitespace inside a quoted string is preserved exactly, but unquoted strings may be re-quoted if they contain characters that trigger quoting on the second pass.
What does the Swap button do?
Swap moves the Output text into the Input field and flips the conversion direction in one click. This is the standard "round-trip" workflow: paste JSON in, convert to YAML, swap, convert back to JSON. If the two JSON outputs are identical (modulo formatting), the YAML round-trip is lossless. If they differ, you have found a YAML feature the parser does not support (e.g. an anchor or a flow-style mapping).
Is my data private?
Yes. The JSON parser is native JavaScript JSON.parse. The YAML parser and serializer are custom pure-JS code inlined into the HTML. There are no network calls, no CDN dependencies, and no telemetry. Drag-dropped files are read by the browser FileReader API and stay on your device. You can convert internal config files containing secrets without worry.