About YAML to JSON
This reads a YAML document and produces the equivalent JSON. It handles the block style that configuration files are actually written in: nested mappings defined by indentation, and sequences marked with a leading hyphen. Comment lines are skipped, and values that look numeric are converted to numbers.
It is a focused parser rather than a complete YAML implementation, and knowing the boundary saves time. Anchors and aliases, multi-line block scalars written with a pipe or angle bracket, and the flow style that uses braces and brackets inline are all outside what it reads. For the plain indented mappings that make up the overwhelming majority of configuration files it works as expected.
Values surrounded by single or double quotation marks are unwrapped, and the strings true, false and numeric-looking text are converted to their JSON types. That means a version number written as 1.0 becomes a JSON number, which is worth watching for if the value is really an identifier rather than a quantity.
How to use YAML to JSON
- 1 Paste the YAML content, preserving its indentation.
- 2 The equivalent JSON appears immediately, with two-space indentation.
- 3 Check any numeric-looking values — a version like 1.0 may have become a number rather than staying text.
Frequently asked questions
Does it support anchors and aliases?
No. Those constructs, along with multi-line block scalars and inline flow syntax, are outside what this parser reads. It targets the plain indented mapping style that configuration files almost always use.
Why did my version number become a number instead of text?
Because values that parse as numeric are converted to JSON numbers. A version written as 1.0 is indistinguishable from the quantity 1.0 to the parser. Quote it in the YAML source if it needs to remain a string.
How are comments handled?
Lines beginning with a hash are skipped entirely, so commentary does not appear in the JSON output. JSON has no mechanism for carrying comments, so there is nowhere for them to go.
Why is my indentation producing a strange structure?
Because YAML determines nesting from indentation alone, so inconsistent spacing changes the meaning. Ensure each level is indented consistently — two spaces throughout is the usual convention — and verify that no tabs crept in alongside spaces.
Free, online, and private
Free to use
YAML to JSON is completely free. There is no account to create, no login, and no hidden charge or usage limit.
Runs online in your browser
It is a free online tool that runs entirely in your browser. Nothing to download or install — open the page and start using it right away.
Your data stays private
All processing happens locally on your device. Your input is never uploaded, stored, or tracked, so it never leaves your browser.
How YAML to JSON behaves in detail
These are the specifics of this implementation — the exact ranges, defaults and fixed settings you are working with.
| Parameter | Value |
|---|---|
| Structure detection | indent width only — a line at the same or a smaller indent closes the block that was open |
| Skipped lines | blank lines and lines whose first non-space character is # are dropped before parsing begins |
| Scalars | a value that Number() accepts becomes a JSON number; anything else becomes a string with one pair of surrounding quotes stripped |
| Sequences | lines starting with "- " collect into a JSON array attached to the current key |
| Bare words | true, false, null and ~ stay strings, because Number() is the only test applied |
| Output indent | 2 spaces |
Compiled from the implementation of this tool and checked against it by itoolnet.
What YAML to JSON does not do
Knowing the edges of a tool saves more time than another list of its features. These are the cases where it will not do what you might expect.
- A list of objects, the most common shape in a YAML config, is not understood: a "- name: John" entry inside a list becomes the array element string "name: John" and the sibling key indented under it is discarded.
- Flow collections are treated as text. A line like "tags: [a, b]" produces the JSON string "[a, b]" rather than an array, because the value is only passed through Number() and then quote-stripped.
- Booleans and null are not typed: "enabled: true" becomes the string "true" and "nothing: null" becomes the string "null", so anything consuming the JSON has to coerce those fields itself.
- Numbers are normalised through Number(), which silently drops leading zeros and rewrites exponents — code: 007 becomes 7 and big: 1e3 becomes 1000 — while an inline comment stays glued on as text, so "key: 1 # note" becomes a string.
- Block scalars are destroyed: a pipe or angle marker used to start a multi-line string is stored as the literal character and the indented continuation lines are skipped entirely, so the text is lost rather than preserved.
Tested and documented by itoolnet, the team that builds and maintains this site.