JSON to YAML Converter

Options

Max 1 MB · Converts automatically as you type

Processed entirely in your browser — nothing is sent to a server.

YAML (YAML Ain’t Markup Language) and JSON describe the same basic shape — nested maps, lists, strings, numbers, booleans, and null — through two very different surface syntaxes. JSON is punctuation-heavy and fully explicit (every string quoted, every object wrapped in braces), which makes it easy for a program to parse unambiguously but noisy for a person to read or hand-edit. YAML strips almost all of that away in favor of indentation and bare words, at the cost of being a considerably more complex format to parse correctly (its own spec runs to hundreds of pages, covering block and flow styles, multiple string-quoting conventions, anchors, and more). Most developers end up needing both: APIs return JSON, but Kubernetes manifests, Docker Compose files, GitHub Actions workflows, and most CI/CD pipeline configs are written in YAML specifically because it’s easier for a human to read and edit by hand.

Converting between them is mostly mechanical — the data structure doesn’t change, only its surface syntax — but a few real differences matter. Going from JSON to YAML, this tool offers block style (the traditional indented form) or flow style (JSON-like inline braces/brackets, useful for keeping a small nested value compact), a configurable line width for wrapping long values, and optional key sorting. Going from YAML to JSON, it resolves everything YAML supports that JSON has no equivalent for: multi-line block scalars (| preserves line breaks literally, > folds them into spaces) collapse to a single JSON string; anchors and aliases (&name / *name, YAML’s way of reusing a value without repeating it) resolve to their actual values, since JSON has no concept of a reference; and explicit type tags (!!str, !!int) resolve to the JSON type they force.

Numeric precision is preserved in both directions — this tool never silently rounds a number to fewer digits than it already had. And unlike JSON, YAML has no comments at all in the JSON output direction: a # comment in your YAML source simply has nothing to convert to, since JSON’s grammar has no comment syntax whatsoever, so it’s dropped rather than smuggled into the data somehow.

Security is a real consideration here, not a footnote. Some YAML parsers historically supported tags that reconstruct arbitrary JavaScript objects, regular expressions, or even functions directly from document text — a genuine code-execution risk when the YAML comes from somewhere untrusted, which describes exactly the pasted-from-anywhere use case this tool exists for. This tool never enables that behavior; see the FAQ below for exactly why.

Examples

Frequently asked questions

Is my data sent anywhere?
No. Both conversion directions run entirely in your browser — no network request, nothing logged. This matters here specifically: a real config file, API response, or environment file routinely carries database credentials, API keys, or other secrets, and none of it ever leaves your device.
Can YAML comments survive being converted to JSON?
No — JSON has no comment syntax at all, so a # comment in your YAML is simply dropped when converting to JSON. This isn't a bug to work around; it's a structural limit of the target format. If you need to preserve commentary alongside the data, keep it in the YAML source and only convert a copy.
How are YAML dates handled?
A YAML timestamp (an unquoted date like 2024-01-15 or a full 2024-01-15T10:30:00Z) is parsed as a real date and serialized to JSON as an ISO 8601 string ("2024-01-15T10:30:00.000Z") — JSON has no native date type, so a string is the closest faithful representation. A quoted date ("2024-01-15") is left as plain text instead, since quoting it is how YAML itself says "treat this as a string, not a date."
Why does converting YAML with !!js/function or similar tags fail?
By design. Some old YAML libraries support tags like !!js/function that reconstruct executable JavaScript straight out of the document text — pasting an untrusted YAML file into a tool built on one of those libraries can mean running someone else's code in your browser. This tool is built on js-yaml's current major version, which removed that entire class of tag from its core parser — there's no "safe mode" toggle involved, because the unsafe behavior isn't present to opt out of. A tag like that is rejected the same way any other unrecognized tag would be: a clear parse error, nothing executed.
Is there a size limit, and what happens with a large file?
1 MB. Parsing and converting both run synchronously in your browser tab, so a file at or near that limit may take a brief moment on slower devices — there's no server-side processing to wait on either way. Anything larger is rejected with a clear error before conversion is attempted, rather than freezing the tab.