YAML ⇄ JSON Converter
Convert YAML documents to JSON and back.
This tool runs entirely in your browser. Your data is never uploaded, never stored, and never leaves your device.
YAML and JSON describe the same data in different syntax, and this converter moves a document between the two — parsing with js-yaml, and reporting the line and column of anything that will not load.
How to use it
- 1Switch between YAML → JSON and JSON → YAML with the two buttons above the input.
- 2Paste a single document. The result appears as you type; multi-document YAML separated by --- is refused with "expected a single document in the stream".
- 3Copy the output. In the JSON → YAML direction, long lines are wrapped at 100 characters.
Example
- Input
- debug: no port: 8080
- Output
- { "debug": "no", "port": 8080 }
no stays the string "no". This parser follows YAML 1.2, where only true and false are booleans — YAML 1.1 tools would have turned it into false, and that mismatch is a long-standing source of config bugs.
What happens to your data
This tool runs entirely in your browser. Your input is never uploaded to a server, never stored, and never logged. YAML is where deployment configs tend to keep their secrets, so parsing is done locally by the js-yaml library bundled into the page.
Last updated August 2026
Someone sends you a config as JSON and the pipeline that has to read it wants YAML. Or a colleague pastes forty lines of docker-compose into a ticket and you need it as JSON so a script can pick two fields out of it. Both formats describe the same shapes — maps, lists, strings, numbers, booleans and null — so the translation is mechanical right up to the point where it is not.
The thing to settle before you paste anything is which direction is the lossy one. JSON to YAML is the safe way round: everything JSON can express, YAML can hold. The other way is not, because YAML carries several things JSON has nowhere to put — comments above all, along with anchors and aliases, explicit tags, and the difference between a folded block and a literal one. Convert a Kubernetes manifest to JSON and every note your team left in it disappears.
That leads to the common mistake, which is treating a round trip as reversible. YAML in, JSON out, back to YAML gives you a file that means the same thing to a machine and is unrecognisable to whoever maintains it. Convert a copy; keep the original as the one you edit.
The second trap is quoting. YAML guesses types from how a value is written, so a version number or a leading zero can arrive as something you did not intend. Put single quotes round anything that has to stay text before converting, rather than repairing the JSON afterwards.
How it works
Toolvore converts one direction at a time, in the page, with the js-yaml library bundled into the JavaScript already downloaded. Both routes pass through an ordinary JavaScript value in the middle, and that middle step is where everything is won and lost. Going to JSON, the parsed value is printed again at two-space indentation, so comments, blank lines, quoting style and block scalars are gone by definition — the parser resolved them and nothing carried them forward. Anchors are expanded rather than preserved, so a map referenced in five places is written out five times and the output can be far larger than the input. Numbers pass through the double-precision arithmetic JavaScript uses everywhere: an identifier longer than about seventeen digits comes back rounded, a version written as 3.10 becomes 3.1, and infinity and not-a-number have no JSON spelling, so both land as null. Only the YAML 1.2 core types are recognised, which is why a custom tag is refused rather than ignored.
Common use cases
- Turning a docker-compose file into JSON for a script to read
- Rewriting a JSON settings block as YAML for a CI pipeline
- Checking whether a hand-edited manifest parses at all before committing it
- Finding the line and column of an indentation error a build log only hinted at
- Seeing what a value like 08 or 3.10 actually becomes once parsed
- Expanding anchors and aliases to see what a config resolves to
- Reformatting a minified JSON payload pasted out of a log
Frequently asked questions
Is JSON valid YAML, and can I paste JSON into the YAML side?+
YAML 1.2 is a superset of JSON, and this parser behaves that way: braces and brackets are YAML written in flow style. Paste a JSON document into the YAML to JSON direction, minified or pretty-printed, and it loads without complaint and comes back re-indented at two spaces, which makes that side a usable JSON tidier when you have nothing else to hand. The reverse does not hold — a YAML file using indentation instead of braces is not JSON, and pasting one into the JSON to YAML direction gives you a parse error from the browser rather than a conversion.
Which values do I need to put in quotes in YAML?+
Anything that could be read as another type. Booleans are true and false in any capitalisation, so True and FALSE convert too. The words yes, no, on and off stay strings under YAML 1.2, but an older 1.1 parser turns them into booleans — the classic Norway problem, where a country code of NO becomes false somewhere downstream. Quote them anyway. Numbers deserve the same care: a version written 3.10 arrives as 3.1, and a leading zero is dropped, so 0755 becomes 755 and an account number written 0123456789 loses its first digit.
What happens to the comments in my YAML file?+
They cannot survive, because JSON has no comment syntax. The parser reads them and discards them, and nothing in the output marks where they were — which in most YAML files is where the reasons live, so it is often the majority of the human value in the document. The trap works the other way too: a config written in JSON with C-style comments, sometimes called JSONC, is not valid JSON and the JSON to YAML direction refuses it at the first slash. Strip those comments, or bring the file in through the YAML side, which accepts hash comments happily.
What happens to anchors, aliases and merge keys?+
Anchors and aliases are resolved during parsing, not preserved. A map defined once and referred to in five places is written out five separate times, so the JSON is correct but longer, and the shared definition you were relying on for maintenance is gone. Merge keys deserve their own warning: the merge type is not part of the YAML 1.2 core set, so a line reading << followed by an alias is not merged into the surrounding map — the key << survives literally, holding the referenced map as its value. Check the output before assuming your defaults were applied.
Why does my CloudFormation or pipeline template report an unknown tag?+
Because tags outside the core set are not recognised, and the parser stops rather than guessing. A template containing !Ref or !GetAtt, or a document using the binary type, produces an unknown scalar tag message naming the line and column of the offending tag. That is the honest behaviour for a converter that does not know your schema: a tag is an instruction to build a value of some application-specific type, and there is no general JSON equivalent for one. To convert such a file, replace the tags with their long form first, or convert only the parts that avoid them.
Can YAML use tabs, and why does my hand-edited file keep breaking?+
Never for indentation — tab characters there are rejected outright, with the line and column named, and it is a common reason a hand-edited file fails. Set your editor to insert spaces for YAML and it stops happening. The worse case is the indentation mistake that does not fail: misalign the items of a list and they can be read as one plain scalar spread over several lines, so a two-item list arrives as a single joined string. Nothing errors, the output is quietly wrong, which is why it is worth reading the JSON rather than treating no red text as success.
Is my config file uploaded anywhere when I convert it?+
Nothing is sent anywhere. What you type lives in the page as component state, the conversion runs in a memo that recomputes as you type, and the parsing is done by a library bundled into the JavaScript your browser already loaded — no upload, no request, no server route behind it. That is the reason to prefer a local converter for this format in particular: YAML is where deployment configs keep database passwords, API keys and connection strings, and pasting one into a remote service hands those over. Closing the tab is the whole of the cleanup.
Do large numbers and IDs survive the conversion intact?+
Not always. Every number goes through JavaScript's double-precision arithmetic, which holds integers exactly only to sixteen or so digits. A twenty-digit identifier such as 12345678901234567890 comes back as 12345678901234567000, silently, with nothing to say the last digits were invented. Anything that is an identifier rather than a quantity should be quoted as a string in the YAML, which also protects it from the leading-zero problem. Two more values have no JSON spelling: infinity and not-a-number, written .inf and .nan, both convert to null, so their presence means the conversion changed the meaning.
Used in these workflows
Related tools
JSON Formatter & Validator
Format, validate, and minify JSON documents.
JSON ⇄ CSV Converter
Convert JSON arrays to CSV and CSV back to JSON.
YAML Formatter & Validator
Validate YAML and re-format it with consistent indentation.
CSV to Markdown Table
Turn CSV data into a formatted Markdown table.