Skip to content
SyntaxSnap

JSON to YAML Converter

Paste JSON to get readable YAML for config files, Kubernetes manifests and CI pipelines. Values that YAML could misread are quoted, so the data means the same thing after conversion. One of our free JSON tools.

JSON

581 B

YAML

How to convert JSON to YAML

  1. Step 1

    Paste the JSON

    Paste it, drop a file, or load a URL. Comments and trailing commas are accepted.

  2. Step 2

    Choose the indent

    Pick 2 or 4 spaces and, if you like, sort the keys alphabetically.

  3. Step 3

    Copy the YAML

    Copy it or download data.yaml.

Worked example

"on", "4" and the date are quoted because many YAML parsers would otherwise read them as a boolean, a number and a date. Real numbers like 80 stay unquoted.
Input: JSON
{"service":"web","ports":[80,443],"env":{"MODE":"on","WORKERS":"4"},"since":"2026-10-22"}
Output: YAML, 2-space indent
service: web
ports:
  - 80
  - 443
env:
  MODE: 'on'
  WORKERS: '4'
since: '2026-10-22'

How JSON maps to YAML

Every JSON value has a direct YAML equivalent. Objects become mappings, one key: value per line, with nesting shown by indentation instead of braces. Arrays become sequences, one item per line after a dash. Strings are written without quotes when that is safe, numbers, booleans and null are written as is, and empty objects and arrays appear as {} and []. Strings with line breaks use YAML's literal block style (|-), so multi-line text stays readable.

Why some strings get quotes

YAML guesses the type of unquoted values, and older YAML 1.1 parsers, which many tools still use, guess aggressively. Unquoted on, off, yes and no are booleans there, 4 is a number, 2026-10-22 is a date, and 0755 is an octal number. The famous example is the country code for Norway, NO, turning into false. To keep your strings as strings in every parser, the converter wraps any value that could be misread in single quotes. Text containing : or starting with a character that has meaning in YAML, such as * or &, is quoted for the same reason.

Indentation and order

YAML only allows spaces for indentation. Choose 2 spaces, which Kubernetes and most CI documentation use, or 4. Keys stay in the order of your JSON unless you tick Sort keys. Long strings are never folded onto several lines, so URLs, keys and certificates come out on one line exactly as they went in.

What does not carry over

The converter works from the parsed data, so comments in a JSONC input are accepted but not copied. YAML supports comments, so add # notes afterwards where they help. Repeated objects are written out in full rather than as anchors and aliases, which keeps the output simple for tools that do not support them.

Common uses

Turn the JSON output of kubectl get -o json or a Terraform plan into YAML you can edit, convert a package.json section into a GitHub Actions step, or rewrite an OpenAPI document from JSON to YAML. Going the other way? Use YAML to JSON.

Questions and answers

Is JSON already valid YAML?

Almost always. YAML 1.2 was designed so that JSON documents are valid YAML. Converting still helps because block-style YAML is easier to read and edit, and it is what Kubernetes, Docker Compose and CI tools expect in their docs.

Why are some values in quotes?

Strings that YAML could read as something else are quoted so they stay strings: yes, no, on and off (booleans in YAML 1.1), numbers such as "4", dates such as "2026-10-22", and text containing a colon followed by a space.

Does it create anchors and aliases?

No. Repeated objects are written out in full every time, which is what most tools expect. Add anchors by hand afterwards if you want to deduplicate.

Can it read JSON with comments?

Yes. Comments and trailing commas in the input are accepted, but they are not carried over, because the converter works from the parsed data. Add YAML # comments after converting.

Can I convert the YAML back to JSON?

Yes. Use Send to, then YAML to JSON, and you get the same data back.

Related tools

All JSON & Schema tools

Next step

Need this built into your stack?

The team behind SyntaxSnap builds custom code generators, internal developer tools and API integrations.