YAML to JSON Converter
Convert YAML configuration into JSON. Supports nested maps, lists and scalars.
What the converter reads
It handles block-style YAML: key: value maps, - item lists, nesting by indentation, and full-line # comments. The sample gives:
Nested maps and lists of maps work too, the shape you find in many Compose and CI files. Indentation is compared by counting leading characters, so keep it consistent within a block:
Which values become numbers, booleans and null
Unquoted values are typed by a short, strict set of rules. Only the exact words true and false are booleans, only plain digits with an optional minus and decimal point are numbers, and an empty value, ~ or null becomes null. Everything else is a string:
| YAML line | JSON value |
|---|---|
enabled: yes | "yes" |
debug: no | "no" |
upper: True | "True" |
lower: true | true |
released: 2026-10-19 | "2026-10-19" |
version: 1.10 | 1.1 |
zip: 02134 | 2134 |
exp: 1e3 | "1e3" |
empty: | null |
tilde: ~ | null |
quoted: "true" | "true" |
single: '42' | "42" |
esc: "a\nb" | "a\\nb" |
Two of these may differ from what other tools give you. Older YAML 1.1 parsers read yes and no as booleans; here they stay text. And a number with leading zeros loses them, so quote ZIP codes, version numbers like 1.10 and anything else that must stay exactly as written. Quotes are removed but escape sequences inside them are not processed, so \n stays a backslash and an n.
YAML features it skips without an error
The parser is deliberately small. Some valid YAML is skipped or kept as plain text, and you won't get a warning:
- Keys containing spaces or wrapped in quotes are dropped, which is why
my keyis missing. - Inline lists and maps such as
[a, b]stay as one string. Only the empty forms[]and{}are understood. - Multi-line blocks after
|or>become an empty object. - A comment after a value is kept as part of the value.
- Anchors and aliases (
&and*) are not resolved. - Several documents separated by
---are merged into one object.
Compare the key count of your input and output when converting a file you didn't write yourself.
Frequently asked questions
Is the key order kept in the JSON?+
Mostly. Keys come out in the order you wrote them, except keys that are whole numbers, such as 2 or 10. JavaScript puts those first, in ascending order, ahead of the other keys.
Does it accept tabs for indentation?+
It counts a tab as one character of indentation, so a file indented only with tabs converts. Mixing tabs and spaces in the same block will nest things wrongly, and the YAML standard itself does not allow tabs for indentation.
Can I minify the JSON output?+
The output is always indented with two spaces. Paste it into the JSON Minifier if you need it on one line.
Embed this tool on your website
Free to use on blogs, school sites and intranets. Paste this code into your page's HTML; please keep the credit line.
<iframe src="https://utilityapp.lat/embed/convert/yaml-to-json" title="YAML to JSON Converter" width="100%" height="600" style="border:0;max-width:760px" loading="lazy"></iframe> <p style="font-size:13px"><a href="https://utilityapp.lat/convert/yaml-to-json">YAML to JSON Converter</a> by UtilityApp</p>