YAML is the same data as JSON, written for people to read and edit. JSON is a data tree of objects, lists, numbers and strings. Python sits between the two, and this page says exactly what happens to a YAML file on the way to becoming a JSON one.
What runs when a YAML file becomes JSON
Python and its standard library, on a machine we rent and watch. Your YAML file is uploaded once, Python runs once, the JSON comes back, and neither file is kept. YAML to JSON is one of the 3649 pairs that engine was probed on with a real file, which is why it has a page here and why the pairs the probe could not prove do not.
What survives from the YAML into the JSON
Every value, and the names you gave them. This pair reads your YAML into memory and writes it back out as JSON: no field is renamed, reordered into something else or quietly dropped. The engine reads its own output back and counts the elements, and refuses the result if the count moved.
The whole structure, at any depth. YAML and JSON describe the same shapes, so nesting, lists, numbers, booleans and null all cross over as themselves. This is the one part of the family where nothing at all is at risk.
What YAML to JSON costs you
Comments, and formatting. A YAML carries both; the conversion reads the data and writes it afresh, so the layout is the writer's and the comments are gone. The data itself is untouched.
Where YAML and JSON files come from
YAML. Written in 2001 to be readable where JSON is merely parseable. It holds exactly the same shapes, so the conversion between the two loses nothing. It is what most tools reach for when a human will have to open the file: Kubernetes, GitHub Actions, Docker Compose.
If a model is going to read the JSON
Structure is what survives from the YAML file, and structure is what a model needs. YAML in, JSON out, with the heading tree intact instead of flattened into one long paragraph.
YAML to JSON, measured rather than promised
Running YAML to JSON against the real engine with a real file, Python wrote 110 bytes of JSON in under a tenth of a second, machine otherwise idle. That is one YAML file on one day and not an average, which is why the number is given together with the file that produced it.
The YAML to JSON verdict was reached by parsing the data back and finding a witness word, meaning the output was read back and recognised. Which check was used matters, because they do not all prove the same thing, and a status code of 200 proves nothing whatsoever about whether the JSON file has anything inside it.
Other ways into JSON, and what they measured
Among the published routes into JSON, YAML is the eighth largest output of the 8 measured. The witness files differ, so this ranks the probe run and not your document.
DOCX to JSON: 1,722 bytes in 0.1 seconds.
HTML to JSON: 2,058 bytes in under a tenth of a second.
MD to JSON: 1,726 bytes in under a tenth of a second.
ODT to JSON: 1,761 bytes in 0.1 seconds.
RTF to JSON: 1,743 bytes in 0.1 seconds.
What we will not pretend about YAML to JSON
A YAML file over 25 MB is refused before the upload finishes rather than after it, so you do not wait for a rejection.
A YAML to JSON run that passes 50 seconds is killed, and the Python process is killed with it. A run left behind would sit on one of the machine's two cores until somebody noticed.
Whether this pair works depends on your data and not only on the two formats. A YAML whose shape does not suit JSON is refused with 422 and a message naming what is missing, which is different from "this format is not supported" and is said differently on purpose. The refusal is immediate and costs nothing.
Note on the word JSON, because it means two things here. Converting Markdown or a Word file to JSON gives pandoc's syntax tree, which describes the document. Converting a YAML gives your data. Both are JSON and they are not the same thing; the site picks by source, which is the only way to tell them apart.
XML is not in this family, and it is the obvious absence. It has no evident mapping to this model: attributes against elements, mixed text, significant order. Every conversion would mean inventing a convention, and an invented convention is a trap for whoever reads the file next. The family stays with what translates without arbitrary choices.
One YAML file at a time, chosen in the browser. There is nothing else to set up and nothing else on offer.
YAML to JSON: what people ask
What actually converts my YAML file to JSON?
Python does it, and its standard library, on a machine we rent and watch. Not a browser trick and not somebody else service: the YAML file is uploaded once, Python runs once, the JSON comes back, and neither file is kept afterwards.
How long does YAML to JSON take?
On the file the probe used, Python took under a tenth of a second and wrote 110 bytes of JSON. That is one real measurement on one real YAML file, not an average and not a promise about yours: a larger YAML takes longer, and past 50 seconds the run is stopped.
What do I lose going from YAML to JSON?
The one to know about first: Comments, and formatting. A YAML carries both; the conversion reads the data and writes it afresh, so the layout is the writer's and the comments are gone. The data itself is untouched.
Will my comments survive?
No. The conversion reads the data and writes it afresh, so comments and layout are the writer's. The data itself is untouched, at any depth.
Is my data sent anywhere else?
No. It goes to one machine we rent and watch, is read by Python and written back out, and neither file is kept. There is no third-party service in this family and no model reading your data.
Is YAML to JSON free?
There is a free allowance every month, and one YAML to JSON conversion costs half a credit against it. When the allowance runs out the tool says so and stops, rather than quietly handing you a worse JSON.