JSON to YAML Converter
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
- Converting a Kubernetes deployment manifest — paste the JSON form of a Deployment resource (as returned by <code>kubectl get deployment -o json</code>) and get back the YAML most Kubernetes tooling and documentation actually uses, correctly nested and indented.
- Making an API response readable — paste a minified JSON response straight from a network tab and convert it to YAML for a quick, less punctuation-heavy read, especially for deeply nested objects where JSON's braces and quotes start to blur together. For working with the JSON itself instead, see JSON Formatter.
- Turning a Docker Compose snippet into JSON for scripting — paste a <code>docker-compose.yml</code> service definition and get JSON out, ready to feed into a script or a programmatic config-generation tool that expects JSON rather than YAML.
Frequently asked questions
Is my data sent anywhere?
Can YAML comments survive being converted to JSON?
# 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?
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?
!!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.