YAML to JSON and Back
Paste either one and get the other, without uploading it.
Runs entirely in your browser
Loading the tool…
Paste either format and the other appears. There is no direction to choose: every JSON document is also valid YAML, so the only question is which one you wrote, and the page works that out and says which it saw. Nothing is uploaded, because there is no server behind this and no network code in it.
Key order is kept. Most converters hand the document to a hash map somewhere in the middle and give it back alphabetised, which turns a readable config file into a diff nobody can review. The order you wrote is the order you get back, both ways.
Merge keys are expanded. A compose file or a CI config full of
<<: *defaults converts to the JSON it means, rather than to JSON
with a literal key called << in it, which is what a plain
deserialiser produces and what makes the result useless.
YAML holds things JSON has no way to write, and this says what it does with each
rather than failing or guessing quietly. Several documents in one file become an
array. A number or a date used as a key becomes text. A tag like
!Ref is dropped and its value kept. What cannot survive either way are
comments: they are not data, and nothing that reads YAML into data keeps them.
How to use it
- Paste YAML or JSON. Nothing is uploaded when you do.
- Read the result, which converts as you type.
- Copy it, or feed it back in to go the other way.
Questions
Which direction does it convert?
Whichever one you did not paste. Every JSON document is also valid YAML, so there is nothing to choose: the page checks whether the text was written as JSON and converts to the other. It tells you which it saw, so you can tell when it has guessed differently from you.
Does it keep the order of my keys?
Yes, both ways. That is worth checking in any converter you use, because many run the document through a hash map and return it alphabetised. Reordering a config file makes every line show up in a diff and hides the change you actually made.
What happens to my comments?
They are lost, and no tool of this kind can do otherwise: converting means reading the file into data, and a comment is not data. If comments matter, edit the YAML rather than round-tripping it through JSON.
Does it understand anchors and merge keys?
Yes. An anchor and alias are expanded where they are used, and <<: *defaults is applied as the merge it means rather than becoming a key called <<. That last one matters for docker-compose files and CI configs, where a naive converter produces JSON that no longer works.
What about several documents in one file?
YAML lets one file hold several documents separated by ---, and JSON does not, so they come out as an array of documents in the order they appear. A single document stays an object rather than becoming an array of one.
Is my file uploaded anywhere?
No. The conversion runs in WebAssembly on your own machine and there is no network request in the code, so disconnect and it still works. Configuration files tend to have hostnames, tokens and internal addresses in them, which is a good reason not to paste them into a website that does have a server.
Your data stays on your device
Everything above runs inside your browser as WebAssembly compiled from Rust. Nothing you type is uploaded, logged or stored on a server. There is no server. You can load this page once, go offline, and it still works.