Paste JSON and readable YAML appears instantly. Pick the indentation, quote style and line width, sort keys if you like, then copy the result or download it as a .yaml file. Your data never leaves your browser.
Last updated:
1
YAML output
Converts automatically as you type.
Advertisement
Advertisement
How to use the JSON to YAML Converter
Paste your JSON into the left box, upload a .json file, or click Sample.
Check the status bar. If the JSON has a mistake, the line is highlighted with the reason; click Go to error to jump there.
Choose the YAML style: indentation, quote style, line width and whether keys are sorted.
Need several documents? Tick Array items as separate documents to write each item of a top-level array after a --- line, as Kubernetes manifests do.
Copy or download the YAML.
JSON vs YAML: the same data, two notations
Data
JSON
YAML
Object
{"name": "web", "port": 80}
name: web port: 80
Array
["a", "b"]
- a - b
Nested object
{"db": {"host": "localhost"}}
db: host: localhost
Empty values
{}, [], null
{}, [], null
String that looks like another type
"true", "30"
'true', '30' (quoted so it stays a string)
Multi-line string
"Line one\nLine two"
|- block with each line indented
Why convert JSON to YAML?
YAML is the usual format for configuration: Kubernetes manifests, Docker Compose files, GitHub Actions and GitLab CI workflows, Ansible playbooks and many app settings files. It needs no braces, brackets or commas, and it allows comments, so people find it easier to read and edit. JSON is better for APIs and machine-to-machine data. Converting lets you take an API response, a JSON schema example or a kubectl get -o json output and turn it into a config file you can maintain.
Because YAML uses indentation for structure, always use spaces, never tabs, and keep the indentation consistent. After editing the result by hand, paste it into the YAML Validator to check it, or convert it back with the YAML to JSON Converter.
Frequently asked questions
How do I convert JSON to YAML?
Paste the JSON into the input box. It is parsed and written out as YAML immediately: objects become key: value lines, arrays become lists with a dash before each item, and nesting is shown with indentation instead of braces and brackets.
Is every JSON file valid YAML?
Almost. YAML 1.2 was designed as a superset of JSON, so most JSON documents are already valid YAML. Converting to YAML's block style simply makes them much easier to read and edit.
Why are some strings quoted in the YAML?
Strings that would otherwise be read as another type, such as "true", "null", "123" or "yes", or that contain characters like : or # in risky places, are quoted so the YAML loads back to exactly the same data. Plain words stay unquoted.
Does the converter keep the order of keys?
Yes. Keys keep the order they have in your JSON unless you tick Sort keys, which sorts them alphabetically at every level.
What happens to very large numbers?
JSON numbers are read as JavaScript numbers, which are exact only up to 9,007,199,254,740,991. Longer integers, such as some IDs, would be rounded, so the tool warns you. Put such values in quotes in the JSON to keep them exactly.
Which library does the conversion?
It uses js-yaml, a widely used open-source YAML parser and writer for JavaScript. It runs locally in your browser, so nothing is uploaded.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.