All processing happens in your browser. Your file is never uploaded to any server.
Paste JSON
Upload File

Click to select or drag & drop a .json file


    
Why these values are quoted

All conversion runs in your browser. Your data is never uploaded to any server.

JSON to YAML

This free JSON to YAML converter turns JSON into YAML entirely in your browser. Paste your JSON or upload a .json file, choose how strict the quoting should be, read the output, and download a .yaml file. Nothing leaves your device, and there is no sign-up.

Converting JSON to YAML looks like a formatting job, but the one thing that actually breaks data is quoting. Write yes unquoted and a YAML 1.1 reader hands you back a boolean. Write 007 unquoted and you get the number 7. Write 2001-12-14 unquoted and a YAML 1.1 reader hands you back a date instead of a string. None of those round-trip. This page decides quoting against a named resolver — YAML 1.2 core schema or YAML 1.1, your choice — and then lists every value it quoted together with the rule that forced it.

How to use this JSON to YAML converter

What this tool supports

Quoting: when a value must be quoted

A plain (unquoted) YAML scalar is not always a string. Every YAML processor matches it against a list of regular expressions first, and whatever matches wins. Two rules follow from that, and this page applies both:

The resolvers are transcribed from the specifications: the YAML 1.2.2 specification, section 10.3.2 (Core Schema, Tag Resolution), and the YAML 1.1 type definitions for bool, int, float, null and timestamp. The structural rules come from the plain-scalar productions of the YAML 1.2.2 specification. Here is what that means for real values:

Value in your JSONUnquoted, read back by YAML 1.2 (core schema)Unquoted, read back by YAML 1.1What this page writes
"true", "false", "True", "FALSE"booleanboolean'true'
"yes", "no", "on", "off", "y", "n"string — safe unquotedboolean'yes' under 1.1, plain yes under 1.2
"null", "~"nullnull'null'
"" (empty string)null — an empty plain scalar is nullnull""
"007"integer 7integer 7 — a leading 0 means octal'007'
"0x1F"integer 31integer 31'0x1F'
"1_000"string — safe unquotedinteger 1000 — _ is ignored'1_000' under 1.1
"190:20:30"string — safe unquotedinteger 685230 — base 60'190:20:30' under 1.1
"2001-12-14"string — the core schema has no timestamp typetimestamp'2001-12-14' under 1.1
"1.0"float 1.0float 1.0'1.0'
".inf", ".nan"floatfloat'.inf'
"#9"cannot be a plain scalar — starts with #same'#9'
"a: b"split into key a and value bsame'a: b'
"- item"read as a sequence entrysame'- item'
" padded "leading and trailing spaces are droppedsame' padded '

Keys are checked with the same rules. A JSON key such as "true", "007" or "yes" is quoted as well, because an unquoted key is resolved by the very same list of regular expressions.

Indentation

Two or four spaces per level. Sequences are written with the classic - prefix and their contents indented one level, so a list of objects comes out as - id: 1 followed by the remaining keys aligned under id.

Nulls, empty objects and empty arrays

Multi-line strings

By default a string containing line breaks is written as a literal block scalar: the key is followed by |, |- or |+, and the text follows on indented lines. |- means no trailing newline, | means one trailing newline, and |+ means every trailing newline is kept — the page picks the header from your actual string so the value round-trips. Switch Line breaks to Escaped and the same string is written on one line with \n inside double quotes instead.

A block scalar cannot preserve trailing spaces on a line or leading indentation on its first line. When your string has either, the page falls back to the escaped form and says so in the explanation list, instead of silently losing those characters.

Numbers and key order

Privacy

Uploaded files are read with the browser's own file reader and never leave your device. There is no upload endpoint on this page, no account, and no stored history. You can disconnect from the internet after the page loads and it will still work.

What this tool does not do

FAQ

Is this JSON to YAML converter free?

Yes. It is free with no login and no usage limit, and all processing stays in your browser. For the other directions see the JSON to CSV converter, the JSON to Excel converter, the JSON to XML converter and the CSV to JSON converter.

Do I have to upload my JSON file?

No. The file is read locally with the browser's file API and converted in the page. Nothing is uploaded, logged or stored, and you can go offline after the page loads.

What is the difference between .yaml and .yml?

They are the same format with two different file extensions. This tool downloads a .yaml file with a timestamp in its name; renaming it to .yml changes nothing about the contents, and every YAML reader accepts both.

Why is my string quoted when I did not ask for it?

Because writing it unquoted would change its value, or because it cannot be written as a plain scalar at all. Open Why these values are quoted under the output: each row gives the value, its position in your document, and the exact rule — for example "Ambiguous: an unquoted value reads back as bool under YAML 1.1".

Why is "yes" quoted under one setting but not the other?

Because the two versions disagree. The YAML 1.1 bool type resolves y, yes, on, no, off and their capitalised forms to booleans; the YAML 1.2 core schema resolves only true, True, TRUE, false, False and FALSE. Set Read back as to the version that will actually parse your file, and the quoting follows it.

Which version should I choose if I am not sure?

Choose YAML 1.1. It resolves a larger set of plain scalars to non-string types — booleans, base-60 and underscore integers, timestamps — so this page quotes more values under it. More quotes are always safe: a quoted scalar is a string in every version. Fewer quotes are only safe if you know the reader.

Does it keep the order of my keys?

Yes, exactly as written, including keys that look like numbers. The JSON is parsed by a purpose-built parser rather than by JSON.parse, whose objects reorder integer-like keys.

How are multi-line strings written?

As literal block scalars by default: | with the text on the following indented lines, and |- or |+ depending on whether your string ends with a newline. Switch Line breaks to Escaped for a single-line \n form instead. If a block scalar cannot preserve your string's trailing spaces, the page uses the escaped form and tells you.

Can it keep my comments?

No. JSON has no comment syntax, so there is nothing in the input to keep. Comments are valid in YAML output, but they have to be added by you after converting.

Is there a file size limit?

There is no imposed limit — conversion runs in your browser's memory, so very large files depend on your device. The JSON to CSV converter page covers how this applies to large inputs.

My JSON was rejected. Why?

The error names the line and column. The usual causes are a trailing comma, a single-quoted string, an unquoted key, or a comment — none of which are legal JSON.