JSON to YAML Converter
Convert JSON to YAML for free — paste JSON or open a file and get clean, readable block-style YAML for Kubernetes, Docker Compose, GitHub Actions, OpenAPI and other config files. Choose 2 or 4 space indentation and optional A–Z key sorting; strings that YAML would misread (yes/no, version numbers, colons) are quoted automatically. JSON errors show the exact line and column.
100% private — everything runs in your browser. Conversion happens on your device; nothing is uploaded.
Converted with the open-source js-yaml library (MIT); strings that would be misread (like “yes”, “1.0” or ones containing colons) are quoted automatically. Runs in your browser — config files never leave your device.
How to convert JSON to YAML
- Paste your JSON or click Open file.
- Pick the indent and whether to sort keys.
- Read the YAML as you type.
- Copy it or download the .yaml file.
What you can use it for
- Write Kubernetes and Docker Compose configs from JSON
- Convert package.json-style data to YAML
- Create GitHub Actions and CI configuration
- Make OpenAPI / Swagger specs easier to read
More free tools
Building for the web?
Format, minify, convert and generate code with our free, private developer tools.
See all free tools →Frequently asked questions
Is YAML a superset of JSON?
Mostly — valid JSON is valid YAML 1.2, but block-style YAML is far easier to read and edit, which is why configs use it.
Why are some values in quotes?
Values like “yes”, “on” or “1.10” would change type or meaning in YAML, so they're quoted to keep them as strings.
Can I convert YAML back to JSON?
Yes — use the YAML to JSON converter.
Is my data uploaded?
No. It's converted in your browser — nothing is sent to a server.
What do the Indent and Sort keys A–Z options do?
Indent sets how far each nested level is pushed in: 2 spaces, the default, or 4. With 4 spaces, an object inside a list starts on the line after its dash. Sort keys A–Z orders the keys at every level in character order, so capitalised keys come before lowercase ones. List items always keep their original order, and the YAML updates as soon as you change either option.
Does it keep my key order?
Yes, unless you tick Sort keys A–Z. Keys come out in the order they appear in your JSON, at every level. One exception comes from how the browser's JSON parser stores objects: keys that are whole numbers, such as "9" or "10", move to the top of their object in numeric order. If those keys must stay where they are, rename them, for example with a letter prefix.
How are multi-line and long strings written?
A string with line breaks becomes a literal block: a | or |- marker followed by the text on indented lines, exactly as written. |- is used when the text has no line break at the end, | when it does. Long single-line strings are never wrapped or folded, so each stays on one line however long it is. Tabs and control characters are written inside double quotes as escapes such as \t.
How are numbers, booleans, null and empty values converted?
Numbers, true, false and null are written without quotes, just as in the JSON. Empty arrays and objects appear as [] and {}, and an empty string as ''. Numbers stored as strings, such as "8080", are quoted so they stay strings. The JSON is parsed first, so 1.0 becomes 1, and integers longer than about 16 digits lose precision; store those as strings if they must stay exact.
Why do I see a “Couldn't convert” message?
It means the input isn't valid JSON. The message gives your browser's reason and the line and column where the problem starts, so you can go straight to it. Typical causes are a trailing comma after the last item, single quotes instead of double quotes, comments, and a missing comma between two items. Fix that spot and the YAML appears as soon as the JSON parses.
Do I need to sign up, and does it need an internet connection?
No account is needed, and the YAML updates as you type, paste or open a file. When the page opens, it loads the open-source js-yaml library (version 4.1.0) from the jsDelivr CDN, so you need a connection at that point; your JSON itself is never sent. If the library can't load, the tool shows “Couldn't load the YAML library — check your connection.”
What happens if my JSON has duplicate keys?
The JSON still converts, but only the last value for a repeated key is kept. For example, {"a": 1, "a": 2} becomes a: 2, and no warning is shown. This comes from your browser's JSON parser, which reads the input before the YAML is written. If a value seems to be missing from the output, search your JSON for the same key appearing twice in one object.