What this tool does
JSON and YAML describe the same kinds of data: objects, lists, text, numbers, true, false and null. JSON is strict and easy for programs to exchange, while YAML is easier for people to read and edit, which is why Kubernetes manifests, Docker Compose files and CI workflows use it. This converter writes your JSON as clean YAML, and every value keeps its type and meaning.
Paste your JSON and the YAML appears while you type. Copy it or download it as a .yaml file.
Why quoting matters in YAML
YAML lets you write most text without quotes, and that is part of why it reads so well. The catch is that a parser decides the type of an unquoted value by looking at it. A plain true is a boolean, null is nothing, and 42 is a number. Older YAML 1.1 parsers go further: they also read yes, no, on, off, y and n as booleans, 0755 as an octal number, and 12:30 as a number in base 60.
This is the well-known "Norway problem". A list of country codes that contains NO turns into false for Norway when it is written without quotes, and a file mode of 0755 becomes the number 493.
This tool quotes every string that any common YAML version could read as something else, so the text in your JSON stays text:
- Words that look like booleans or null: yes, no, on, off, y, n, true, false, null and ~, in any letter case.
- Anything that starts like a number: 1e3, 0755, 0x1F, 1_000, 2026-10-22, .5, .inf.
- Strings that start with a character that has a special meaning in YAML, such as -, ?, :, #, &, *, !, |, >, %, @ or a quote.
- Strings that contain ": " or " #", end with a colon, or start or end with a space.
- The empty string, written as
''.
Everything else stays plain, so names, sentences, URLs and paths stay readable. When a string needs quotes but no escapes, single quotes are used. When it holds a control character, a byte order mark or a lone surrogate, it gets double quotes with escapes such as \u0001, so nothing invisible slips into your file.
Multiline strings as block literals
A JSON string with line breaks, such as a shell script, an SQL query or a certificate, becomes a block literal. It starts with a | on the key line, and every line of the text follows on its own indented line, exactly as it is. The indicator after the | tells the parser how the text ends: | keeps one final line break, |- means there is none, and |+ keeps several. Quotes and # need no escaping inside it.
A block literal cannot hold every text exactly. If the first line starts with a space, or the text has carriage returns or control characters, the string is double-quoted with \n escapes instead, so the data still reads back identically.
Numbers, empty values and nested data
Numbers are written exactly as they appear in your JSON, so an ID like 12345678901234567890 is not rounded and 1.0 stays 1.0. A note warns you when a number is too long for some YAML tools to read exactly. Empty arrays and objects are written as [] and {}, and null stays null.
Nested objects become indented blocks, and arrays become lists with a dash per item. An array of objects, the most common shape in config files, puts the first key on the dash line and the other keys below it:
env:
- name: MODE
value: production
Indentation and sorted keys
Two spaces is the most common style and keeps deep files narrow; four spaces makes levels easier to tell apart. List items always start with a dash and one space, and the lines of an item line up after the dash. Both read back to the same data.
Sort keys A to Z orders the keys inside every object, at every level, by character code, so uppercase letters come before lowercase ones. Arrays keep their order, because the order of a list has meaning. This helps when you keep config in version control.
JSON Lines and errors
JSON Lines files hold one JSON value per line. When the tool finds several values, each one becomes its own YAML document, and the documents are separated by --- lines.
JSON allows the same key twice in one object, but YAML does not. If your JSON repeats a key, a warning names the key and its line, and the YAML keeps the last value, just like JSON.parse in JavaScript.
If the JSON is not valid, the tool shows the line and column of the first problem with a plain reason, such as a trailing comma or single quotes. The JSON formatter helps you tidy and check the input, and the guides on common JSON errors and on what an Unexpected token error means explain the usual fixes.
Related tools
To turn the same JSON into a spreadsheet instead, use the JSON to CSV converter. Config values are sometimes stored as Base64, and the Base64 encoder and decoder reads them. To learn when to keep JSON compact and when to make it readable, see format or minify JSON.
Privacy
The conversion runs in your browser. Your JSON is not uploaded, saved or tracked, and there is no sign-up. The input is limited to 1,000,000 characters, about 1 MB, so the page stays fast. Like every page on this site, this one may show ads from third-party vendors once ads are switched on, and those vendors can use cookies. Read the privacy policy for details.