Skip to main content

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.

JSON input
YAML output
name: Toolk
version: 1.0.0
tools: 65
free: true
features:
  - ad-free
  - fast
  - private
config:
  port: 3000
  ssl: true
  limits:
    requestsPerMinute: 60
    uploadMb: null

This 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)

  1. Set the direction: JSON → YAML or YAML → JSON, using the toggle.
  2. Paste your source into the input panel, or click Load sample to see a typical config converted.
  3. Read the output the instant it converts — valid input produces output, bad input shows a line-numbered error.
  4. Use Swap to feed the output back as input and round-trip-test the conversion.
  5. 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

AspectJSONYAML
QuotingAll strings quoted with double quotesStrings usually unquoted; quote only when ambiguous
CommentsNo comments allowed (use JSONC or JSON5 extensions)Hash-prefixed (# comment)
Multi-line stringsSingle-line only with \n escapesBlock scalars (| literal, > folded), single-line as default
Structure delimitersBraces { } and brackets [ ] (explicit)Indentation (whitespace-significant)
Trailing commasForbidden (strict JSON); allowed in JSON5Not applicable — no commas in block style
Booleans / nulltrue, false, null (lowercase only)true/True/TRUE, false/False/FALSE, null/~/empty
Best forAPIs, machine-to-machine, configuration with strict schemaHuman-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.

ContextFormatNotes
Kubernetes manifestsYAML requiredapiVersion, kind, metadata, spec — all standard k8s files.
GitHub Actions workflowsYAML required.github/workflows/*.yml — name, on, jobs, steps.
Docker ComposeYAML requiredcompose.yaml or docker-compose.yml — services, volumes, networks.
CI configs (CircleCI, Travis)YAML requiredBuild pipelines historically standardized on YAML for human edit.
Ansible playbooksYAML required*.yml — tasks, hosts, vars, handlers.
REST API responsesJSON requiredAll major HTTP frameworks emit JSON by default.
package.json / tsconfig.jsonJSON requiredNode.js ecosystem manifests.
OpenAPI specsEitherOpenAPI 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.

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.

Browse all tools