Convert YAML to JSON and back, with the comments, anchors and extra documents a conversion loses listed for your particular file rather than in the abstract.
Waiting for YAML
Every JSON document is valid YAML, so this direction is the lossy one.
The conversion appears here
Paste a document on the left; the other format appears here.
YAML to JSON Converter runs entirely on your device — nothing is uploaded.
You’re on the Free plan. Compare plans
Every JSON document is valid YAML, which makes one direction trivial and the other lossy. Going from YAML to JSON throws away comments, anchors, multiple documents and the distinction between quoting styles, because JSON has nowhere to put any of them.
Rather than mentioning that in the abstract, the page says which of those your particular file is losing. A YAML file with no comments and no anchors converts cleanly, and knowing that is worth more than a general warning.
The type traps survive the conversion and become visible, which is half the reason to convert in the first place. An unquoted `1.10` in YAML is the float 1.1, so it arrives in JSON as `1.1` with the trailing zero gone — that is the conversion working correctly and the YAML being wrong, and it is far easier to see once it is JSON.
Going the other way, a JSON string that looks like a YAML keyword is quoted on the way out. `{"enabled": "yes"}` must not become `enabled: yes` and come back as a boolean, and a converter that does not handle that produces a round trip which changes your data.
Yes, since YAML 1.2 — the specification was deliberately made a superset. That is why converting JSON to YAML never loses anything and the reverse sometimes does.
They are gone. JSON has no comment syntax, so there is nowhere to put them. If the comments matter, keep the YAML as the source of truth and treat the JSON as derived.
They are expanded. The resulting JSON repeats the value wherever the alias appeared, which is correct but larger — and converting back gives you the repetition rather than the anchor.
It becomes a JSON array, one element per document, because JSON has no document separator. A Kubernetes manifest with several resources converts that way.
Because it was unquoted in the YAML, which made it a float. `1.10` is the number 1.1, and the conversion is faithfully reporting what the YAML said. The fix is in the YAML: quote it.