01 / JSON / json-yaml
JSON ↔ YAML Converter
Convert JSON to YAML and YAML to JSON.
How to use
- 01Paste JSON into the JSON input box. The Direction control starts on JSON → YAML.
- 02The YAML output fills in live. If the JSON can't be parsed, an Invalid JSON message shows where.
- 03Choose 2 spaces or 4 spaces under Indent to match your project's YAML style.
- 04Use Copy output, or Download to save the result as converted.yaml.
- 05Press Swap ⇄ to move the YAML into the input and flip the direction, which is a quick way to round-trip the result back to JSON.
What is this tool?
This converter turns JSON into clean block-style YAML, the format Kubernetes manifests, Docker Compose files, GitHub Actions workflows and most CI configs expect. It parses the JSON strictly first, so a malformed payload is reported instead of being half-converted. Strings that would be misread as numbers or that contain YAML syntax are quoted automatically. Conversion runs in your browser, and nothing is uploaded.
Worked example: converting a JSON config to YAML
Take {"service": "orders-api", "replicas": 3, "env": {"LOG_LEVEL": "info"}, "ports": [8080, 9090]}. With 2-space indentation, the output is service: orders-api, then replicas: 3, then an env: line with LOG_LEVEL: info indented beneath it, then ports: followed by two list items, - 8080 and - 9090. Braces, brackets and most quotes disappear. Nesting is expressed by indentation and list items by a leading dash.
The converter keeps types intact. Numbers and booleans stay unquoted, while a string such as "123" or "1.10" is written in double quotes. Without the quotes, a YAML parser would read those strings back as numbers. The same applies to strings that contain a colon followed by a space, or are empty.
Gotchas when moving from JSON to YAML
The output follows YAML 1.2, where words like yes, no, on and off are ordinary strings. The converter therefore writes a JSON string "no" as a bare no. Tools that still use YAML 1.1 rules, such as older PyYAML-based scripts, would read that bare no as the boolean false. This is the well-known "Norway problem", where the country code NO turns into false. If your YAML will be read by such a tool, quote those values by hand.
Also keep in mind that JSON has no comments, so the YAML you get has none either. Add comments after converting. And because YAML depends on indentation, keep the generated spacing when pasting into an existing file. Mixing 2-space and 4-space blocks in one document is legal but hard to review, and tabs are never allowed for indentation.
Common use cases
- Turning a JSON API response into a YAML fixture for a config-driven test
- Converting a Kubernetes object pulled with kubectl get -o json into an editable manifest
- Rewriting a JSON-based CI or linter config into the YAML form a new tool requires
- Producing readable YAML from JSON to paste into documentation or a pull request description
- Migrating OpenAPI or AsyncAPI definitions from JSON to YAML for easier review
FAQ
How do I convert JSON to YAML?
Paste your JSON into the input with the direction set to JSON → YAML. The YAML appears immediately, and you can copy it or download it as converted.yaml.
Why are some values quoted in the YAML output?
Strings that look like numbers (such as "123" or "1.10"), contain ": ", or are empty are quoted. Without quotes, a YAML parser would read them as a different type or misparse them.
Can I choose the indentation?
Yes. Pick 2 spaces or 4 spaces under Indent, and the output updates right away.
Why doesn't my JSON convert?
The input must be strict JSON. Trailing commas, comments, single quotes or unquoted keys cause an Invalid JSON error with the position of the problem.
Is my data uploaded during conversion?
No. Parsing and conversion run locally in your browser.