Convert YAML to JSON
Turn a YAML file into JSON.
About this converter
Usually so something can read it that does not speak YAML — a script, a browser, a tool that only takes JSON on standard input.
Anchors and aliases are resolved as it converts. YAML lets a block be defined once and referenced elsewhere, and JSON has no such thing, so the referenced content is written out in full wherever it was used. The result is longer than the YAML and means exactly the same thing.
Three things do not survive, and cannot: comments, because JSON has none; the distinction between a quoted and an unquoted string, because JSON quotes everything; and a file containing several documents separated by ---, of which only the first is converted. Everything else comes across intact.
Frequently asked questions
Where did my comments go?
Nowhere they could go — JSON has no comment syntax at all. If the comments matter, keep the YAML as the source of truth and generate the JSON from it rather than the other way round.
Why does it say my YAML is invalid?
Nine times in ten it is indentation, and most of those are a tab character. YAML forbids tabs in indentation entirely, and an editor set to insert them produces a file that looks perfectly aligned and will not parse. The error message names the line.
What about a file with several documents in it?
Only the first is converted. A YAML file can hold many documents separated by ---, and JSON has no equivalent — a Kubernetes manifest bundle is the usual case. Split it and convert each part.
Does what I paste get sent anywhere?
No. The conversion runs in your browser, on your own machine — which is why the result appears as you type. Nothing is uploaded and nothing is logged. That matters for this kind of tool in particular: config files and API responses are exactly the things that carry keys, hostnames and customer data.