YAML to JSON Converter
Paste YAML (Kubernetes manifests, Docker Compose, CI configs) and get clean JSON instantly. Errors show the exact line with a pointer.
Runs in your browserNo sign-upNothing uploaded
How to use the YAML to JSON
- Paste YAML into the left box or open a
.yaml/.ymlfile. - JSON appears on the right as you type. Choose 2 spaces, 4 spaces or tabs for the output.
- Tick Sort keys to order keys alphabetically. This helps when comparing configs.
- If the YAML is invalid, the status bar shows the line and column, and the offending lines appear below it with a
^marker. - Copy or download the JSON, or press Swap to convert it back to YAML.
How YAML maps to JSON
JSON is a subset of YAML 1.2, so every YAML mapping becomes a JSON object, every sequence becomes an array, and scalars become strings, numbers, booleans or null. YAML-only features are resolved during conversion:
- Comments (
# …) are dropped, because JSON has no comments. - Anchors and aliases (
&base,*base,<<: *base) are expanded into full copies. - Timestamps such as
2024-01-02become ISO 8601 strings. - Multi-line strings (
|literal and>folded blocks) become ordinary strings with\nescapes.
Multi-document YAML
A single file can hold several YAML documents separated by ---, as is common in Kubernetes manifests. JSON has no equivalent, so the converter returns a JSON array with one element per document and says so in the status bar. A lone trailing --- is ignored.
YAML 1.1 vs 1.2 gotchas
This converter follows YAML 1.2, the current spec. Many older tools (PyYAML, Ruby's Psych, some Kubernetes and Ansible versions) still read YAML 1.1, where the rules differ:
- The Norway problem: in YAML 1.1,
country: nomeansfalse, so Norway's country codeNOdisappears. The same goes foryes,on,off,yandn. YAML 1.2 only treatstrueandfalseas booleans. - Octal numbers:
0755is octal in 1.1 but a plain decimal in 1.2, which uses0o755. Quote file modes to be safe. - Sexagesimal numbers: in 1.1,
22:30can parse as the number 1350. Quote times and port mappings such as"8080:80".
The JSON → YAML direction quotes ambiguous strings ('no', 'on', 'y') automatically, so the YAML it produces reads the same in both versions.
Frequently asked questions
Is my YAML uploaded anywhere?
Why does my YAML fail with “bad indentation”?
-) are indented consistently under their parent key.What happens to YAML comments?
Why did <code>no</code> stay a string?
true/false are booleans. Older YAML 1.1 parsers would turn no, yes, on and off into booleans (the “Norway problem”).Can I convert a Kubernetes manifest with several resources?
----separated resource becomes one element of the output JSON array, ready for jq or kubectl apply -f -, which accepts JSON lists too.