RevealTheme logo

JSON to YAML Converter

Paste JSON and get block-style YAML with 2-space indentation, generated entirely in your browser. Best for turning API responses and JSON config into more readable YAML for hand-editing.

How to use this tool

  1. 1

    Paste or type your JSON into the text box.

  2. 2

    The converter parses it with JSON.parse and renders YAML below as you type.

  3. 3

    If the JSON is malformed, a red parser error appears instead of output — fix the JSON and the YAML updates.

  4. 4

    Select the YAML in the output block and copy it into your config file.

What does converting JSON to YAML actually involve?

JSON and YAML describe the same data model — maps, sequences, strings, numbers, booleans, and null — so converting between them is a re-serialization, not a translation. YAML is in fact a superset of JSON, meaning any valid JSON is already valid YAML, but the reverse is not true. The point of converting is readability: YAML drops the braces, brackets, and commas, using indentation and newlines instead, which suits hand-edited config files for tools like Docker Compose, Kubernetes, GitHub Actions, and Ansible. This tool walks the parsed JSON tree recursively and emits block style only: two spaces of indentation per nesting level, 'key: value' for scalars, and '- ' bullets for arrays. It does not emit flow style ({}, []), anchors and aliases (&, *), explicit type tags (!!str), multi-line block scalars (|, >), comments, or document markers (---). Quoting is deliberately minimal: a string is only wrapped in quotes when it contains a colon, a hash, or a newline. Empty objects render as {} and empty arrays as []. The result is clean YAML for typical data, but not a full YAML 1.2 emitter.

Common use cases

  • Turning a JSON API response into a YAML snippet you can paste into a Kubernetes or Docker Compose file.

  • Rewriting a package.json fragment or settings blob as YAML to read it more easily during review.

  • Drafting a GitHub Actions or GitLab CI workflow when you have the config as JSON but the pipeline expects YAML.

  • Converting a JSON fixture into YAML for an Ansible playbook or a Helm values file.

  • Quickly checking how a nested JSON structure looks once the braces and commas are stripped away.

  • Producing readable YAML examples for documentation from JSON you already have.

Frequently asked questions

Is my data uploaded anywhere?
No. Parsing and conversion run entirely in your browser with JSON.parse and a local function. Nothing you paste is sent to a server, so it is safe for private config and tokens.
Will the YAML round-trip back to identical JSON?
For typical data, yes. But quoting here is minimal — a string is only quoted when it contains a colon, hash, or newline. Strings like 'yes', 'true', 'null', '123', or values with leading spaces are emitted unquoted, so a strict YAML parser may read them back as a boolean, null, number, or trimmed string. Verify round-trips on edge-case strings.
Does it support full YAML 1.2?
No. It is a naive emitter that produces block-style YAML only. It does not generate flow style, anchors and aliases, type tags (!!str), block scalars (| and >), comments, or document separators (---). For those features use a library such as js-yaml, PyYAML, or ruamel.yaml.
How is indentation handled?
Each nesting level adds two spaces. Nested objects and arrays are placed on their own indented lines under their key. There is no option to change the indent width.
What happens to arrays of objects?
Each element gets a '- ' bullet, and an object element is emitted as an indented block on the following lines. Scalar array items appear inline after the dash, like '- 42'.
Why am I seeing a red error message?
The input failed JSON.parse — usually a trailing comma, single quotes, unquoted keys, or a stray character. JSON requires double-quoted keys and strings and no trailing commas. Fix the JSON and the YAML regenerates automatically.
Are key orders preserved?
Yes. Keys are emitted in the order JSON.parse returns them, which follows the object's insertion order for string keys, matching how your JSON was written.

Related tools