JSON → YAML Converter
Paste JSON below, get YAML out. Useful for moving data between systems that prefer different encodings (e.g. Kubernetes manifests, Helm values, Hugo / Jekyll front matter).
How the conversion works
JSON's six value types map to YAML directly:
| JSON | YAML |
|---|---|
"hello" | hello (quoted only when ambiguous) |
42 | 42 |
true / false | true / false |
null | null |
[1, 2] | - 1 |
{"a": 1} | a: 1 |
When to convert
- Kubernetes / Helm. Most charts and manifests are YAML; ad-hoc values are often easier to write as JSON and convert.
- Hugo / Jekyll / Astro front matter. Some sites prefer YAML; others accept JSON. Converting lets you reuse the same source.
- OpenAPI specs. Both encodings are accepted; YAML is more readable for hand-editing.
- GitHub Actions / GitLab CI. YAML-native; if you have a JSON config from another system, convert and paste.
When NOT to convert
- API payloads. Just use JSON. YAML in HTTP bodies is non-standard and often unsupported.
- Logs / structured events. JSON's strict, machine-readable form wins. YAML's flexibility is a liability for log indexing.
- Wire protocols. JSON is universally supported; YAML parsers vary in strictness.
YAML's gotchas
YAML is more flexible than JSON, which means it has more ways to be wrong:
- The Norway problem.
NO: country can parse as false: country in YAML 1.1. Always quote string keys/values that look like booleans or numbers. - Indentation matters. Tabs and spaces aren't interchangeable. Most parsers reject tabs.
- Anchors and aliases (
&name, *name) — JSON has no equivalent, so they're never produced by this converter. - Multi-document streams (
--- separators) — YAML can have multiple documents in one file. JSON cannot. The converter outputs a single document.
The reverse direction (YAML → JSON)
Until we ship a dedicated YAML → JSON page, the simplest tools:
# Python
python3 -c 'import yaml,json,sys; print(json.dumps(yaml.safe_load(sys.stdin)))' < file.yaml
# yq (Go YAML processor)
yq -o=json eval . file.yaml
# Node
node -e 'const yaml=require("yaml");console.log(JSON.stringify(yaml.parse(require("fs").readFileSync(0,"utf8"))))' < file.yaml
FAQ
Is anything sent to a server?
No. Conversion happens in your browser. Open DevTools → Network if you'd like to verify.
What's converted, exactly?
Strings, numbers, booleans, null, arrays, and objects. JSON's primitive types map directly to YAML's. Strings are auto-quoted only when they'd otherwise be parsed as YAML keywords (yes/no/null/etc.) or have special characters.
Can I round-trip JSON → YAML → JSON?
For the data types this tool emits, yes — both encodings represent the same set of primitives. YAML can express things JSON can't (anchors / aliases, custom tags), but converting JSON to YAML doesn't introduce them.
What about YAML to JSON?
Coming soon. For now, run python3 -c 'import yaml,json,sys;print(json.dumps(yaml.safe_load(sys.stdin)))' at the command line.