YAML ↔ JSON Converter — round-trip in your browser
Paste a YAML file and get the JSON. Paste JSON and get the YAML. Switch direction in one click. Runs entirely in your browser using a real YAML parser.
Paste a YAML file and get the JSON. Paste JSON and get the YAML. Switch direction in one click. Runs entirely in your browser using a real YAML parser.
{
"name": "utility-stack",
"version": "1.0.0",
"servers": [
{
"host": "api.example.com",
"port": 443,
"secure": true
},
{
"host": "cdn.example.com",
"port": 443,
"secure": true
}
],
"features": {
"caching": true,
"retries": 3
}
}YAML and JSON are the two dominant configuration formats in modern infrastructure. JSON is the lingua franca of APIs (compact, machine-friendly, supported everywhere); YAML is preferred for human-edited configs (Kubernetes manifests, GitHub Actions, Docker Compose, Ansible playbooks) because it tolerates comments and is less punctuation-heavy.
Conversion between the two is mechanical because YAML is a strict superset of JSON — every JSON document is also valid YAML. The reverse direction can lose information (YAML supports anchors/aliases, multi-line strings and comments that JSON does not), but for most config workloads the round-trip is clean. This tool uses the canonical 'yaml' library, so the parsing matches what your runtime sees.
Since YAML 1.2 (2009), yes. Any valid JSON document is also valid YAML, with the same structure. That's why pasting a JSON object into a YAML field usually 'just works'. The reverse is not true: YAML has features (anchors, comments, multi-line strings) that JSON cannot represent.
JSON has no comment syntax, so when you convert YAML → JSON, all # comments are dropped. The reverse direction (JSON → YAML) cannot magically reintroduce them. If your team relies on comments in config files, keep YAML as the source of truth and treat the JSON as derived.
When converting YAML → JSON, anchors are inlined: each &anchor / *alias pair becomes a duplicated subtree in JSON. The other direction can't generate new anchors automatically. If you rely on YAML anchors for DRY configs, keep YAML as your authoring format.
YAML supports literal block scalars (| keep newlines) and folded block scalars (> fold newlines into spaces). When converting to JSON, both become regular strings with the appropriate newlines or spaces. Going back, the converter picks a sensible YAML representation but may not match your original style.
No. Parsing happens entirely in your browser via the 'yaml' library. Your configs — including any secrets you might have inline — never touch our servers. Safe to use with production manifests.
Where flipping YAML and JSON pays off in seconds.
kubectl outputs JSON when you run kubectl get -o json; your manifests are usually YAML. Paste the kubectl output into the converter to reformat as YAML for a side-by-side diff with your source manifest.
Your code emits JSON; your CI/CD pipeline reads YAML. Generate JSON in code, run it through this tool, paste the YAML into your repo. Bonus: indent of 2 matches the convention everywhere.
An older system emitted YAML; you're rewriting it in TypeScript and want a typed object. Convert YAML → JSON to get a structure you can import directly with const config = require('./config.json').
Backend uses JSON API specs (OpenAPI in JSON); DevOps uses YAML (helm charts). When the same config concepts span both, this tool keeps everyone aligned without rewriting by hand.
Habits that prevent YAML/JSON gotchas.
If the converter shows red, your YAML is invalid. Don't push it. The error message points at the line and column, which usually maps to a typo (missing colon, bad indentation, mixed tabs/spaces).
YAML doesn't care between 2 and 4 spaces, but every linter and formatter expects 2 in the wider ecosystem (Kubernetes, Helm, Ansible, GitHub Actions). Going against it makes your file look strange in code reviews.
Unquoted YAML 'yes', 'no', 'on', 'off' are interpreted as booleans. So 'country: NO' becomes 'country: false'. Always quote string-only values when they look like keywords: 'country: "NO"'.
Mixing tabs and spaces in YAML is the #1 source of parse errors. Configure your editor to insert spaces (never tabs) when editing YAML files. Most modern editors detect file type and switch automatically.