YAML ↔ JSON Converter

Both directions. Client-side. Anchors resolved, YAML 1.2 semantics, real live output.

YAML ↔ JSON, both directions. Client-side, powered by js-yaml. Nothing sent to a server. How to use ↓·Shortcuts ↓
YAML input, JSON output.
Indent:
Samples:
YAML Input
JSON Output
Output will appear here.
Input: 0 chars · 0 bytesOutput: 0 chars · 0 bytes

How to use

Pick a direction with the tabs — YAML → JSON or JSON → YAML. Paste your input on the left. The converted output appears on the right as you type.

Set indent size (both directions), and for JSON→YAML you can sort keys alphabetically or force parts of the output into inline flow syntax.

Keyboard shortcuts

Three shortcuts:

Cmd / Ctrl + KFocus the input pane
Cmd / Ctrl + EnterCopy output to clipboard
Cmd / Ctrl + /Toggle direction

When to use it

YAML and JSON carry the same shape of data; they differ in syntax. Which one is right depends on where the data lives.

  • Kubernetes, Ansible, Docker Compose, CircleCI, GitHub Actions all use YAML — comments and readability win.
  • APIs, config exports, log payloads use JSON — universal parser support, no whitespace-sensitivity gotchas.
  • Converting between them lets you author in one and ship in the other.

Options

Indent — 2 spaces, 4 spaces, or tab (JSON only; YAML doesn't allow tabs for indentation).

Sort keys (JSON→YAML only) — sorts object keys alphabetically. Useful for diff-friendly config files.

Inline from depth (JSON→YAML only) — forces mappings and sequences at or beyond this depth into inline flow syntax ({a: 1, b: 2} instead of block form). Set to Never for pure block style.

Format-specific gotchas

YAML anchors and references are resolved. Input like <<: *defaults merges the referenced mapping into the output — JSON has no anchor concept, so it's expanded.

Comments disappear. JSON has no comments; YAML→JSON drops them silently.

YAML tabs are illegal for indentation. Block YAML mandates spaces. If you set indent to Tab and switch to JSON→YAML, the output uses 2 spaces regardless.

YAML type coercion. Unquoted yes, no, on, off become booleans in older YAML 1.1 mode. This tool uses YAML 1.2 (js-yaml default), so only true/false/null coerce.

Bidirectional round-trip isn't always identical. YAML has many ways to write the same data; converting to JSON and back may produce cleaner but different YAML.

Privacy

Everything runs in your browser. Your YAML and JSON never leave the page — no server, no logging, no analytics on the content.

Frequently asked questions

What is the difference between YAML and JSON?
Same data model, different syntax. YAML uses indentation and is easier to read and write by hand — good for configs. JSON uses braces and brackets, is stricter, and has universal parser support — good for APIs and data interchange.
Which YAML version does this tool use?
YAML 1.2 semantics (via js-yaml). That means yes/no/on/off stay as strings; only true/false/null are booleans/null. If you have YAML 1.1 files with yes-as-boolean, quote them.
Are comments preserved when converting YAML to JSON?
No. JSON has no comment syntax. Comments in the YAML input are dropped from the JSON output.
What happens to YAML anchors and references?
They are resolved. If your YAML uses &defaults and <<: *defaults, the referenced mapping is merged into the output before serialization.
Can I use tabs for indentation in YAML?
No — block YAML mandates spaces. If you pick Tab as indent, JSON output uses tabs but YAML output falls back to spaces.
Does the tool send my data anywhere?
No. All conversion happens in your browser using js-yaml. The input never leaves the page.