Short answer: pick a direction, paste the document, and the other format appears as you type. Anchors and merge keys are expanded, block scalars keep their text, and a syntax error is reported with its line instead of a generic parse failure.
Why the parser matters here
YAML's indentation rules, anchors and block scalars are not something a regular expression can handle. A converter that guesses will happily turn a nested list into a string and produce JSON that looks valid and is wrong — the most expensive kind of bug in a deployment file. This page uses the same library family that CI systems and Kubernetes tooling depend on, with the schema pinned so it cannot silently reinterpret keys.
Once the JSON is out, the JSON formatter can sort keys or minify it, and the text diff shows exactly what changed between two revisions of the same file.
What is preserved, and what is not
- Anchors and aliases: expanded, because JSON has no references.
- Merge keys: merged into the object they appear in.
- Block scalars: the resulting string, including trailing newlines as YAML defines them.
- Comments: dropped — JSON cannot carry them.
- Quoting style inside scalars: normalised, but the value is unchanged.