YAML to JSON and JSON to YAML — Config Converter Without Comment Keeping
Convert Kubernetes, docker-compose and GitHub Actions YAML configs to JSON and back in your browser. This is re-serialization, not a lossless round trip: comments, anchors and multi-document structure are dropped, and unquoted values follow YAML typing rules.
What this converter does — and what it drops
Both directions, one button each
YAML → JSON and JSON → YAML are separate actions. The result overwrites the other editor and is never merged with existing text.
Comments are always lost
YAML comments are discarded when parsing, and the generated YAML never contains comments. JSON has no comment syntax to begin with.
Anchors expand, multi-document fails
&anchor / *alias pairs are resolved into duplicated objects. A file with several --- documents is rejected instead of being merged.
Values follow YAML 1.2 typing
Unquoted 1.0 becomes 1, 2024-01-01 becomes an ISO timestamp, and .inf / .nan become null. Quote a value to keep it as a string.
Runs locally, with file pick and download
Files are read in the browser and nothing is uploaded. There is no hard size limit, but very large files block the tab while converting.
YAML ↔ JSON conversion FAQ
Is the conversion bidirectional?
Yes: one button for YAML → JSON, one for JSON → YAML. But each direction re-serializes the data, so comments, formatting and anchors are not preserved. Generated YAML uses 2-space indentation and folds long strings at 80 columns; there are no indentation or sorting options.
Can comments be kept?
No. The YAML parser drops comments, and the generated YAML never adds them; JSON has no comment syntax. Keep the commented file as the source of truth and treat the conversion output as derived data.
Are anchors, aliases and multiple documents supported?
Anchors and aliases are resolved and written out as duplicated values. Multiple documents (several --- blocks) are rejected with 'expected a single document in the stream'; split them first. This matters for Kubernetes manifests that bundle several resources in one file.
Why did version: 1.0 become 1, and why is yes a string?
Unquoted scalars are typed by YAML rules: 1.0 is a number, so it prints as 1. js-yaml follows YAML 1.2, where yes / no / on / off are plain strings, so a GitHub Actions on: key stays on. Wrap values in quotes when the type must stay a string.
How are dates, big integers and null handled?
An unquoted date such as 2024-01-01 is parsed as a timestamp and becomes 2024-01-01T00:00:00.000Z in JSON. Integers beyond 2^53 lose precision, and .inf / .nan become null. ~, null and empty values all become null.
Can it handle Kubernetes, docker-compose or GitHub Actions files?
Standard single-document YAML works, including these formats. Split multi-document Kubernetes exports first, and remember that comments are dropped — do not use the converted file as the config you commit.
What about file size and privacy?
Everything runs in the browser and no file is uploaded. There is no configured limit, but conversion runs synchronously on the main thread, so multi-megabyte files can freeze the page.

