JSON to YAML Converter
Turn JSON into clean YAML — or YAML back into JSON — as you type. Text that some YAML tools would misread, such as “no”, “0755” and dates, is quoted for you, and errors point to the exact line.
At a glance
- Converts JSON to YAML and YAML to JSON, instantly as you type. Switching direction carries the result across.
- Safe quoting: text such as
yes,no,on,0755,1:30and2026-01-15is written in quotes, because YAML 1.1 tools like PyYAML and Ansible would otherwise read it as true or false, a number or a date. - Numbers are copied digit for digit:
1.50stays1.50, and a 20-digit ID is not rounded. - When reading YAML you choose YAML 1.2 (the current standard) or YAML 1.1. Every unquoted value whose meaning depends on that choice is listed with its line number.
- Anchors, aliases and merge keys (
<<) are replaced by the data they point to, and several documents separated by---become one JSON array. - Mistakes are reported with their line and column. A key written twice in one mapping is refused rather than silently overwritten.
- Layout options: 2 or 4 spaces, quotes only where needed or on every string, lists indented or level with their key, short lists on one line, sorted keys and wrapping at 80 or 120 columns.
- Runs in your browser: the configs and API responses you paste are never uploaded.
Step by step
How to convert JSON to YAML
- 1
Add your JSON
Paste JSON into the input, or click Open file to load a .json file. Comments and trailing commas are accepted.
- 2
Choose the layout
Pick 2 or 4 spaces, and open Options for quote style, list indentation, sorted keys or short lists on one line.
- 3
Check the result
The YAML appears as you type. If the JSON has a mistake, its line and column are shown.
- 4
Copy or download
Copy the YAML or download it as a .yaml file. Choose YAML → JSON to convert in the other direction.
Features
Everything you need, nothing you don’t
Both directions
JSON → YAML and YAML → JSON in one tool. Convert a file, edit it, and switch direction to turn it back.
No Norway problem
The country code NO, the answer yes and the mode 0755 keep their quotes, so no parser turns them into false, true or 493.
Shows what is ambiguous
Paste YAML with a bare no or 0755 and you are told how YAML 1.1 and 1.2 each read it, and on which line.
Exact numbers
Prices, version numbers and long IDs are written exactly as they were, not passed through a floating-point number.
Exact error locations
Bad indentation, a missing quote or a duplicate key is reported with its line and column, and one click jumps to it.
Private
Kubernetes manifests, Compose files and CI configs are converted on your device. Nothing is sent to a server.
How JSON maps to YAML
| JSON | YAML |
|---|---|
{"name": "shop", "port": 8080} | name: shop and port: 8080 on separate lines |
"tags": ["api", "v2"] | tags: followed by - api and - v2 |
"db": {"host": "x"} | db: followed by an indented host: x |
"debug": "no" | debug: "no" (quoted, so it stays text) |
"price": 1.50 | price: 1.50 (digits kept) |
"note": "line one\nline two" | a |- block with one line of text per line |
"owner": null, "tags": [], "extra": {} | owner: null, tags: [], extra: {} |
The same YAML, read two ways
YAML 1.2 has been the standard since 2009, but many widely used tools still follow YAML 1.1, and the two disagree about unquoted values. This is why a list of country codes can end up containing false instead of NO — the “Norway problem”.
| Written in YAML | YAML 1.2 reads | YAML 1.1 reads |
|---|---|---|
debug: no | the text “no” | false |
country: NO | the text “NO” | false |
mode: 0755 | the number 755 | the number 493 (octal) |
time: 1:30 | the text “1:30” | the number 90 (base 60) |
port: 0o17 | the number 15 | the text “0o17” |
on: push | a key named “on” | a key named true |
date: 2026-01-15 | the text “2026-01-15” | a date |
What YAML features become in JSON
- Anchors (
&name) and aliases (*name) are replaced by a full copy of the data, and merge keys (<<: *name) are merged into the mapping. - Several documents separated by
---become one array, with one entry per document. - Block text written with
|keeps its line breaks; text written with>is joined into one line. - Comments are dropped, because JSON has nowhere to keep them.
.infand.nanbecomenull, since JSON has no way to write them. Binary data (!!binary) stays as Base64 text.- Keys that are not text, such as numbers or lists, are turned into text, because every JSON key is a string.
FAQ
Frequently asked questions
Is it safe to convert config files with secrets here?
Why are some strings in quotes and others not?
yes, no, on, off, numbers with a leading zero, values like 1:30 and dates. Choose Double or Single under Quotes to quote every string instead.What is the difference between YAML 1.1 and YAML 1.2?
yes, no, on and off are booleans, 0755 is an octal number and 1:30 is 90. In YAML 1.2 the first group is plain text and 0755 is 755. PyYAML and Ansible follow 1.1; newer parsers follow 1.2. This tool tells you when your YAML contains such values.Why did my key “y” or “on” get quotes?
y, n, yes, no, on and off as booleans even when they are keys, so some parsers would turn the key on into true. The quotes prevent that. Turn off Safe for YAML 1.1 tools if you only use YAML 1.2 parsers.Are comments kept when converting YAML to JSON?
Can I convert a file with several YAML documents?
---, as in many Kubernetes files, become one JSON array with an entry for each document.Does it accept JSON with comments or trailing commas?
Is .yml different from .yaml?
Keep going
Related tools
YAML to XML Converter
Convert YAML to XML and XML to YAML online. Handles attributes, lists, anchors and the root element, shows exact error lines and never uploads your data.
JSON to TypeScript
Generate TypeScript interfaces, types or Zod schemas from JSON online. Finds optional properties, unions and nested types. Free, private, no upload.
JSON Formatter & Validator
Format, validate, minify and repair JSON online. Get the exact line and column of every error, a collapsible tree view and sorted keys — private, in-browser.
JSON to XML Converter
Convert JSON to XML online: attributes, text, arrays and nested data, with a root element, CDATA and pretty or minified output. Free and private, no upload.
XML to JSON Converter
Convert XML to JSON and JSON to XML online. Keeps attributes, arrays and leading zeros intact, shows exact error lines and never uploads your data.
DNS Lookup
Free DNS lookup: check A, AAAA, CNAME, MX, NS, TXT, SOA and CAA records of any domain, see SPF and DMARC, and do reverse DNS for an IP address.
Last updated Report a problem or suggest a feature