A bidirectional YAML and JSON converter that works either way: paste YAML and get clean JSON, or paste JSON and get readable YAML. It is built for developers wrangling Kubernetes manifests, CI pipeline files, Docker Compose configs, OpenAPI specs, Ansible playbooks and application settings — anywhere the same data has to live in both formats. Unlike a quick one-direction snippet, this tool validates the input first, reports errors with a real line and column, and lets you tune the output: indent width, recursive key sorting, block versus flow YAML style, and whether to expand YAML anchors. Everything runs locally, so even private credentials in a config file never leave your machine.
How it works
Under the hood the tool uses the battle-tested js-yaml parser. When you convert YAML to
JSON, it loads the document with a strict schema, supports multi-document streams (the
ones separated by ---), and serialises the result with JSON.stringify using your chosen
indentation. When you convert JSON to YAML, it parses the JSON natively, then renders it
back out with js-yaml using block style by default and an unlimited line width so long
strings are not wrapped awkwardly.
Validation is the part most converters skip. If the YAML is malformed, the parser throws an
exception carrying a mark with the failing line and column; the tool surfaces that plus a
three-line snippet with an arrow at the bad line. If the JSON is malformed, the browser’s
own parser reports a character position, which the tool converts into a line and column the
same way. Either way you see exactly where the problem is instead of a vague “invalid input”.
The Auto-detect and convert button inspects the first non-blank characters of your source
— a leading brace or bracket means JSON, otherwise it is treated as YAML — and flips the
direction for you. Swap moves the result back into the source pane and reverses the
direction, so a quick round-trip is one click. Results can be copied to the clipboard or
downloaded as a .json or .yaml file, and your last-used settings persist in this browser.
Example
Paste this YAML:
name: gera-tools
replicas: 3
ports:
- 80
- 443
With the direction set to YAML to JSON and 2-space indent, you get:
{
"name": "gera-tools",
"replicas": 3,
"ports": [
80,
443
]
}
Press Swap, then Convert, and the JSON round-trips straight back to the original block
YAML. Now feed it broken YAML — say a list item indented one space too few — and instead of a
result you will see something like YAML parse error: bad indentation of a mapping entry at
line 4, column 3, with the surrounding lines shown so the fix is obvious. Toggle Sort keys
and every object in the document is emitted in alphabetical order for clean version-control diffs.
Every conversion happens in your browser. No YAML, JSON, file contents or settings are ever uploaded, and the tool keeps working with your network disconnected.