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.
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
{
"name": "JSON FYI",
"version": "1.4.0",
"tools": ["validator", "formatter", "diff"]
}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.
{
"containers": [
{ "name": "app", "image": "node:20", "port": 3000 },
{ "name": "db", "image": "postgres:16", "port": 5432 }
]
}containers:
- name: app
image: "node:20"
port: 3000
- name: db
image: "postgres:16"
port: 5432First key inline with the dash, subsequent keys indented to align — the standard YAML idiom.
{ "answer": "yes", "ip": "10.0.0.1", "tag": "v1.0" }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
- Editing Kubernetes manifests
Generate a draft YAML from your JSON template and tweak by hand.
- Migrating to GitHub Actions
Convert a JSON-based CI config into the YAML format Actions expects.
- Building Docker Compose files
Start with a JSON description of your stack and emit a working compose.yaml.
- Reading API responses as YAML
YAML is easier to skim than JSON for deeply nested payloads — convert and read.
- Generating Helm values
Turn JSON config into the values.yaml file Helm charts consume.
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.
Read input.json and write idiomatic YAML 1.2 to output.yaml — block style with 2-space indent.
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 }));{
"user": { "id": 1, "name": "Ada", "skills": ["math", "compilers"] }
}user:
id: 1
name: Ada
skills:
- math
- compilersOther JSON tools on JSON FYI
Every flow you need — formatter, validator, viewer, pretty print, repair, and the full workbench.
Pretty-print with custom indent and sort keys.
Strict RFC 8259 syntax check with line + column.
Browse JSON as an interactive collapsible tree.
Compare two JSON files structurally with paths.
Convert arrays into spreadsheet-ready CSV.
Well-formed XML with attributes and indenting.
Beautify JSON with JS- or Python-style indent.
Free in-browser formatter — nothing uploaded.
Pinpoint errors with a catalog of common fixes.
Validate data against a JSON Schema — powered by Ajv.
All tools in one editor: validate, format, view, query.