How to use
Add your JSON
Paste JSON into the left pane, drop or upload a .json file, use Load URL, or press Try sample to load a Kubernetes Deployment written as JSON. Conversion starts right away.
Pick a style
Press a preset, or set Indent, list indentation, Quotes, Style, key sorting and line wrapping yourself. Tick Top-level array as separate documents to split a list of objects with ---.
Copy or download
Press Copy above the YAML pane, or pick .yaml or .yml and press Download. If the JSON has an error, press Go to line to jump to it.
Why JSON to YAML Converter
- Converts live as you type, with presets for Kubernetes, Docker Compose and GitHub Actions.
- Indent, list indentation, quote style, inline style, key sorting and wrapping are all adjustable.
- Keeps numbers, booleans and null as types and quotes strings that would otherwise change type.
- Splits a JSON array into multiple YAML documents, and downloads .yaml or .yml.
JSON vs YAML syntax
JSON and YAML can describe the same data, but they look very different. YAML relies on indentation and dashes where JSON uses braces, brackets and commas, which makes config files shorter and easier to diff.
The table compares the main pieces. The YAML column shows what this converter writes.
Indentation carries meaning in YAML. This converter writes two spaces per level by default, or four if you choose, and mixing indent widths or using tabs in a YAML file causes parse errors.
| Concept | JSON | YAML |
|---|---|---|
| Key and value | {"name": "web"} | name: web |
| Nested object | {"metadata": {"name": "web"}} | metadata: on one line, then name: web indented 2 spaces below |
| List | ["a", "b"] | - a and - b on separate lines |
| String that looks like a boolean | "false" | 'false' |
| Number and boolean | 2 and true | 2 and true |
| Null | null | null |
| Comment | Not allowed | # comment |
Presets for common config files
The presets set the options that differ between popular tools. The YAML stays valid either way; the presets only match the style people expect to see in each kind of file.
| Preset | Indent | List items | Quotes |
|---|---|---|---|
| Kubernetes (kubectl style) | 2 spaces | Same indent as the key (- name: web) | Single, only when needed |
| Docker Compose | 2 spaces | Indented under the key | Double, only when needed |
| GitHub Actions | 2 spaces | Indented under the key | Single, only when needed |