Free JSON to YAML Converter (and YAML to JSON, Bidirectional)
Paste JSON to get clean 2-space block YAML, or paste a Kubernetes, GitHub Actions, or Docker Compose YAML to get parsed JSON. Toggle direction with one click and read line-numbered errors on bad input. Free and 100% client-side — configs never leave your browser.
name: Toolk
version: 1.0.0
tools: 65
free: true
features:
- ad-free
- fast
- private
config:
port: 3000
ssl: true
limits:
requestsPerMinute: 60
uploadMb: nullThis converter implements the most common subset of YAML 1.2 block style — mappings, sequences, scalars, comments, and nesting. Advanced features (anchors, aliases, multi-line block scalars, flow style mixed with block style) may not round-trip perfectly. For complex YAML, double-check your output before deploying.
Bidirectional
JSON → YAML with proper block-style indentation and string quoting. YAML → JSON with a focused YAML-subset parser tuned for real-world config files.
Inline Error Reporting
Malformed input shows a line-numbered error message — no silent failures. Spot the missing colon or unbalanced brace immediately.
One-Click Copy + Sample Loaders
Copy converted output to clipboard. Load sample JSON or YAML to see exactly what the converter produces from typical config patterns.
100% Client-Side
No uploads, no API calls. Configs may contain secrets — they stay in your browser. Works offline once loaded.
JSON to YAML Converter: Bidirectional, Spec-Aware, In-Browser
This JSON to YAML converter turns a JSON document into clean 2-space block YAML, and converts YAML back to JSON. JSON to YAML quotes only ambiguous strings; YAML to JSON parses the YAML 1.2 block subset (mappings, sequences, scalars, comments) and reports errors by line number. It runs 100% in your browser — free, no upload — so configs stay on your device.
How to convert JSON to YAML (or YAML to JSON)
- Set the direction: JSON → YAML or YAML → JSON, using the toggle.
- Paste your source into the input panel, or click Load sample to see a typical config converted.
- Read the output the instant it converts — valid input produces output, bad input shows a line-numbered error.
- Use Swap to feed the output back as input and round-trip-test the conversion.
- Press Copy to send the result to your clipboard for your manifest, workflow, or API call.
What is YAML, and how does conversion work?
YAML ("YAML Ain't Markup Language") is a human-friendly data format that uses indentation instead of braces. Since the YAML 1.2 specification, YAML is an official superset of JSON — every valid JSON document is also valid YAML. JSON itself is defined by RFC 8259 and ECMA-404.
JSON → YAML parses your text with the browser's native JSON.parse(), then walks the tree and emits block-style YAML at 2-space indentation. A string is left unquoted unless it would be ambiguous — the serializer quotes anything that looks like a number, matches a reserved word (true, false, null, yes, no, ~), or contains structural characters. YAML → JSON strips # comments (respecting quoted text), reads indentation to rebuild the tree, and serializes with JSON.stringify().
"YAML prohibits tab characters for indentation to eliminate the tab-versus-space ambiguity."— YAML 1.2.2 spec. Use spaces only; the recommended and most-used indent is 2 spaces per level.
Worked examples: input → output
JSON → YAML · nested object
{"port": 3000, "ssl": true} → port: 3000 ssl: true
JSON → YAML · array of scalars
{"features": ["ad-free", "fast"]} → features: - ad-free - fast
Edge case · the Norway problem
In YAML, unquoted country: NO parses here as the string "NO", not the boolean false. This tool follows YAML 1.2, where only true/false (and their capitalized forms) are booleans. Older YAML 1.1 parsers turned Norway's code NO into false — the famous bug. Quote it as country: "NO" to be safe across every parser.
Edge case · big-integer precision loss
An unquoted id: 9007199254740993 (above 253) is parsed with JavaScript's parseInt, which silently rounds it to 9007199254740992. Quote large IDs and nanosecond timestamps as strings — id: "9007199254740993" — to keep every digit.
JSON vs YAML: eight differences that matter
| Aspect | JSON | YAML |
|---|---|---|
| Quoting | All strings quoted with double quotes | Strings usually unquoted; quote only when ambiguous |
| Comments | No comments allowed (use JSONC or JSON5 extensions) | Hash-prefixed (# comment) |
| Multi-line strings | Single-line only with \n escapes | Block scalars (| literal, > folded), single-line as default |
| Structure delimiters | Braces { } and brackets [ ] (explicit) | Indentation (whitespace-significant) |
| Trailing commas | Forbidden (strict JSON); allowed in JSON5 | Not applicable — no commas in block style |
| Booleans / null | true, false, null (lowercase only) | true/True/TRUE, false/False/FALSE, null/~/empty |
| Best for | APIs, machine-to-machine, configuration with strict schema | Human-edited configs (Kubernetes, GitHub Actions, Docker Compose) |
| File extensions | .json, .jsonc, .json5 | .yml, .yaml |
Where each format is the standard
YAML dominates human-edited infrastructure config; JSON dominates machine-to-machine payloads. This table maps the common contexts so you know which way to convert.
| Context | Format | Notes |
|---|---|---|
| Kubernetes manifests | YAML required | apiVersion, kind, metadata, spec — all standard k8s files. |
| GitHub Actions workflows | YAML required | .github/workflows/*.yml — name, on, jobs, steps. |
| Docker Compose | YAML required | compose.yaml or docker-compose.yml — services, volumes, networks. |
| CI configs (CircleCI, Travis) | YAML required | Build pipelines historically standardized on YAML for human edit. |
| Ansible playbooks | YAML required | *.yml — tasks, hosts, vars, handlers. |
| REST API responses | JSON required | All major HTTP frameworks emit JSON by default. |
| package.json / tsconfig.json | JSON required | Node.js ecosystem manifests. |
| OpenAPI specs | Either | OpenAPI accepts both — YAML for human edit, JSON for tooling. |
The multi-document limit competitors gloss over
Kubernetes files often pack several resources into one file separated by --- document markers. Most online converters claim to handle them; this one is honest about its scope. The parser skips every --- line rather than splitting on it, so a multi-document file is merged into a single structure instead of an array of documents. The fix is mechanical: split your file at each ---, convert each document on its own, then combine the JSON outputs into an array yourself.
Two more deliberate behaviors worth knowing: special floats serialize the YAML way — Infinity becomes .inf, -Infinity becomes -.inf, and NaN becomes .nan. And empty collections stay in flow style: an empty object emits {} and an empty array emits [], not a blank block.
Gotchas when round-tripping JSON to YAML and back
1. Comments are lost
JSON has no comment syntax. A YAML → JSON → YAML round-trip drops every # comment. Keep the YAML source if comments carry context.
2. The Norway problem
YAML 1.1 treated NO, YES, ON, OFF as booleans, so NO became false. This parser follows 1.2, so they stay strings. Quote ambiguous values anyway.
3. Numeric precision
JavaScript numbers max out at 253. Large IDs and nanosecond timestamps round to the nearest float. Quote them as strings to preserve precision.
4. Indentation is normalized
JSON → YAML always emits 2-space indentation. Tabs are illegal in YAML — convert tabs to spaces before parsing, or you will hit a line-numbered error.
Runs 100% in your browser
Your data never leaves your device. The parser and serializer are plain JavaScript with no dependencies and no network calls, so configs holding API keys, database credentials, or internal hostnames stay local — no uploads, nothing leaves your device. I tested both directions against real Kubernetes manifests, GitHub Actions workflows, and Docker Compose files, plus the edge cases above: quoted vs unquoted NO, integers past 253, empty objects and arrays, and multi-document --- files. The supported block subset round-trips cleanly; the documented limits are real, not guesses.
Frequently asked questions
Is this JSON to YAML converter free?
Yes — both directions are 100% free with no signup and no usage cap. Everything runs in your browser, so there is nothing to pay for and no quota.
Does my JSON or YAML get uploaded?
No. The parser and serializer run in your browser tab with zero network calls, so secrets in your configs never leave your device. Verify it in DevTools to Network.
What YAML features are supported?
The YAML 1.2 block subset real configs use: mappings, sequences, scalars, # comments, and nesting. Anchors, aliases, tags, block scalars (| / >), and flow style are not supported.
Why did my large integer change value?
JavaScript numbers are IEEE 754 doubles, so integers above 253 lose precision during conversion. Quote big IDs and nanosecond timestamps as strings to keep every digit.
Related developer & config utilities
Beautify and validate JSON
YAML ValidatorSyntax check with line-precise errors
JSON DiffSemantic compare of two payloads
JSON Schema GeneratorInfer a schema from sample JSON
JSON to TypeScriptGenerate interfaces from JSON
CSV to JSON ConverterReshape tabular data to JSON
XML FormatterPretty-print SOAP, RSS, sitemaps
SQL FormatterFormat queries that feed your JSON
Base64 EncoderEncode config secrets for transport
All ToolsBrowse the full Toolk hub
Guide: JSON vs YAML vs XMLWhen to pick each data format
Guide: JSON ValidationFormat and validate JSON correctly
Last updated: June 2, 2026 · Runs 100% in your browser — no uploads, nothing leaves your device.
Need a different tool?
Browse all 89 free, in-browser tools — or tell us what we should build next.