JSON to YAML Converter

In short: the same data, in the format Kubernetes, Docker Compose, GitHub Actions and half the world’s config files actually want. Paste JSON, get clean block-style YAML with correct quoting — strings that would be misread as booleans or numbers are quoted automatically — entirely in your browser, so private config never leaves the machine.

How JSON becomes YAML

JSON is a subset of YAML 1.2 in spirit — every JSON value is a YAML value — but the two formats differ in how they present structure, and a converter’s real work is presentational plus defensive. Objects become mapping keys at increasing indentation (two spaces per level, the near-universal convention); arrays become dash lists, with nested objects riding on the dash line; scalars pass through — except when they would be misread on the way back. That is the subtle part of this page: a YAML string like yes, on, ~ or 0123 is one careless parser away from becoming a boolean, a null or a number, so any string that a YAML reader could interpret as another type — booleans and nulls in any capitalisation, number-shaped strings, strings containing : or starting with an indicator character like -, # or & — is double-quoted in the output. Round-trip safety beats prettiness: the YAML you download parses back to exactly the JSON you pasted.

Empty containers are the one place block style cannot go: an empty object or array has no lines to indent, so they are written in flow style — {} and [] — which YAML fully supports inline. Everything runs client-side with the browser’s own JSON parser, so invalid JSON is reported with the parser’s own position message rather than a guess, and nothing you paste is transmitted anywhere — a property that matters for the files this converter usually meets: API responses, exported configs, and the occasional secret someone pasted into a JSON blob in 2021 and forgot.

Where the two formats actually meet

The conversion direction tells a story about the tools. JSON is the language of APIs and data exchange; YAML is the language of configuration written by humans — Kubernetes manifests, Ansible playbooks, CI pipelines, OpenAPI descriptions, static-site front matter. The everyday jobs are: an API response that needs to become a fixture or a mock in a YAML test suite; a JSON settings export that a DevOps tool only accepts as YAML; a JSON Schema example that belongs in documentation written in YAML; and the reverse archaeology — reading what a JSON-only tool made of a YAML original. The companion tools on this site cover the rest of the family: the JSON Formatter for tidying and validating the JSON first, the XML to JSON Converter for the older enterprise format, and this page’s sibling, the JSON to XML Converter, for going back the other way.

A worked example

The default input — a small site description — converts to:

site: Calculation Set
tools: 500
live: true
tags:
  - calculators
  - converters
owner:
  name: s2
  plan: null

Note what did not happen: “Calculation Set” needed no quotes (plain scalars may contain spaces), the boolean and the null stayed bare because they really are a boolean and a null, and the array became an indented dash list. Feed it {"answer": "yes", "port": "8080"} instead and both strings come out quoted — answer: "yes", port: "8080" — because unquoted, YAML would hand a reader a boolean and an integer, and your configuration would be quietly wrong in a way no error message would ever announce.

Frequently asked questions

Is my JSON uploaded anywhere?

No. The conversion runs entirely in your browser with JavaScript — the page works with the network cable pulled, and nothing you paste is sent to a server, logged or stored. That is the right architecture for a converter whose typical input is configuration data and API responses, which routinely contain keys, tokens and internal hostnames. If you are converting something genuinely secret, you can verify the claim yourself: open your browser’s network monitor while converting and watch nothing happen.

Why are some strings quoted in the YAML output?

Because YAML would otherwise read them as something else. An unquoted yes, on or true is a boolean in YAML; ~ and null are nulls; 0123 and 1e3 are numbers; a string containing a colon followed by a space is a syntax problem; and a leading dash, hash or ampersand starts a list item, a comment or an anchor. Quoting those strings is not decoration — it is what guarantees the YAML parses back to the exact values in your JSON. Strings that are safe unquoted, including ones with ordinary spaces, are left bare.

Can YAML comments or anchors survive the conversion?

There is nothing to survive — JSON has no comments and no anchors, so the input cannot contain them, and the output is plain data-only YAML. That is a real limitation of the JSON-to-YAML direction generally: if you hand-maintain YAML with comments and anchors, converting away and back loses them permanently. Treat this converter as a one-way data bridge (API output into config, exports into fixtures), not as an editor for hand-crafted YAML files.

What YAML style does the output use?

Block style throughout — indented mappings and dash lists, two spaces per level — with flow style ({ } and [ ]) only for empty containers, which have no block form. That matches what Kubernetes, GitHub Actions, Ansible and most linters expect, and what a human reviewing a diff wants to see. Strings that need protection are double-quoted (the JSON-compatible quoting style, so escapes behave identically in both formats); everything else is a plain scalar.

What happens with invalid JSON?

The browser’s JSON parser rejects it and the page shows the parser’s own error message, including the position, instead of guessing. The usual culprits are trailing commas (legal in JavaScript, illegal in JSON), single-quoted strings, unquoted keys, and comments left in a file someone renamed from .js to .json. Paste the same text into the JSON Formatter on this site first if you want it tidied and the error pinpointed line by line.

Related tools

Converter behaviour checked against YAML 1.2 plain-scalar rules on 24 November 2026. Everything runs in your browser — nothing you paste is sent anywhere.