JSON ↔ YAML Converter
Convert JSON to YAML or YAML to JSON in your browser, with an indent width of 2 or 4 spaces. JSON becomes block-style YAML in which strings that could be misread as numbers, booleans or null, such as "1.10" or "yes", stay quoted, and YAML becomes JSON that is either pretty-printed or written on a single line. Copy the result or download it as converted.yaml or converted.json; nothing is uploaded.
How to use
- Choose the direction: JSON → YAML or YAML → JSON.
- Paste your data into JSON input or YAML input; the output updates as you type, and invalid JSON shows an error with the parser's message.
- Pick an Indent width of 2 or 4 spaces; in YAML → JSON mode, untick Pretty-print JSON to get compact single-line JSON.
- Click Copy or Download (converted.yaml or converted.json), or Swap to move the output into the input and convert it back the other way.
Example
Input
JSON → YAML · Indent width: 2 spaces
{"service": "api", "port": 8080, "debug": false, "version": "1.10", "tags": ["web", "prod"], "env": {"TZ": "Europe/Berlin"}}Output
service: api
port: 8080
debug: false
version: "1.10"
tags:
- web
- prod
env:
TZ: Europe/BerlinFrequently asked questions
Why are some values quoted in the YAML output?
Strings that a YAML parser would read as another type get double quotes: text that looks like a number ("1.10" would otherwise become 1.1), words such as yes, no, on, off, true or null, empty strings, values with leading or trailing spaces and values that start with a YAML special character such as # or *. Line breaks and tabs inside a string are written as \n and \t escapes.
Which YAML features does YAML → JSON understand?
Block mappings and lists, flow collections such as [a, b] and {a: 1}, single- and double-quoted strings, # comments, --- markers, null and ~, true and false, integers and decimals. yes, no, dates and numbers with leading zeros stay strings, and .inf or .nan become null because JSON has no such values. Block scalars (| and >), anchors and aliases (&, *, <<) and tags are not supported, and the converter does not always report an error for them: the rest of the document can be missing, so compare the output with your input.
Are comments and key order preserved?
Comments are dropped, because JSON has no comments and the JSON → YAML output does not add any. Keys keep their order, except that keys made only of digits, such as "1", are moved to the front by JavaScript.
Is my data uploaded?
No. Both directions are converted by JavaScript in your browser, and the input, output and downloaded file never leave your device.