{}JSON FYI
Convert

JSON to YAML converter

Convert JSON into clean, idiomatic YAML 1.2 — block style, 2-space indent, smart quoting. Drop the result straight into Kubernetes manifests, GitHub Actions workflows, or Docker Compose files.

Ready when you are.

Paste JSON on the left, or click Sample to try a quick example. The YAML output appears here as you type — entirely in your browser.

EmptyInput: 0 BOutput: 0 B

What makes a good JSON→YAML conversion?

YAML is a strict superset of JSON, so any valid JSON has a valid YAML representation. The interesting question is which YAML form to emit, because YAML offers more options than you usually want.

JSON FYI picks the most readable and portable form: block style with 2-space indent (the convention used by Kubernetes, Docker Compose, GitHub Actions, and Ansible), and double-quoted strings only when needed to avoid ambiguity.

Multi-line strings use the | literal block scalar style, which preserves newlines and is supported by every mainstream YAML parser. Reserved words like true, false, null, yes, no, on, off get quoted when used as string values, so a JSON string "yes" doesn't accidentally become a boolean after conversion.

Examples

Nested object
Input
{
  "name": "JSON FYI",
  "version": "1.4.0",
  "tools": ["validator", "formatter", "diff"]
}
Output
name: JSON FYI
version: "1.4.0"
tools:
  - validator
  - formatter
  - diff

version is quoted because "1.4.0" looks numeric to YAML. Other strings stay unquoted for readability.

Array of objects (Kubernetes-style)
Input
{
  "containers": [
    { "name": "app", "image": "node:20", "port": 3000 },
    { "name": "db",  "image": "postgres:16", "port": 5432 }
  ]
}
Output
containers:
  - name: app
    image: "node:20"
    port: 3000
  - name: db
    image: "postgres:16"
    port: 5432

First key inline with the dash, subsequent keys indented to align — the standard YAML idiom.

Strings that need quoting
Input
{ "answer": "yes", "ip": "10.0.0.1", "tag": "v1.0" }
Output
answer: "yes"
ip: "10.0.0.1"
tag: "v1.0"

Reserved words and numeric-looking strings get double-quoted so they round-trip as strings.

Use cases

Frequently asked questions

What YAML version does this output?+

YAML 1.2, block-style with 2-space indentation — the convention used by Kubernetes, GitHub Actions, Docker Compose, Ansible, and most modern YAML consumers.

When are strings quoted?+

Only when they would otherwise be ambiguous: empty strings, values that look numeric ("3.14"), reserved words (true, false, null, yes, no, on, off), strings starting with YAML indicators ([ { ! & * - ? @ etc.), and anything containing :, #, or special characters.

How are multi-line strings handled?+

They use the | literal block scalar style, which preserves newlines. Most YAML parsers — including PyYAML, js-yaml, and go-yaml — handle this correctly.

Will the YAML round-trip back to identical JSON?+

Yes for all standard JSON types. Numbers, strings, booleans, nulls, objects, and arrays all survive a YAML → JSON conversion. The order of object keys is preserved.

Why does my YAML differ from another converter's output?+

YAML allows many equivalent forms — flow vs. block style, single vs. double quotes, ~ vs. null. JSON FYI picks block style with double-quoted ambiguous strings, which is the most readable and parser-portable.

Is my JSON uploaded?+

No. The conversion runs 100% in your browser.

Convert JSON to YAML in code

JavaScript, Python, Go, and Ruby snippets — copy and paste into your project.

Convert JSON to YAML

Read input.json and write idiomatic YAML 1.2 to output.yaml — block style with 2-space indent.

npm i yaml && node to-yaml.js
import { readFileSync, writeFileSync } from "node:fs";
import { stringify } from "yaml";

const data = JSON.parse(readFileSync("input.json", "utf8"));
writeFileSync("output.yaml", stringify(data, { indent: 2 }));
Input
{
  "user": { "id": 1, "name": "Ada", "skills": ["math", "compilers"] }
}
Output
user:
  id: 1
  name: Ada
  skills:
    - math
    - compilers

Other JSON tools on JSON FYI

Every flow you need — formatter, validator, viewer, pretty print, repair, and the full workbench.

Related tools & guides