Why convert JSON to YAML
Kubernetes, Compose, and many CI files prefer YAML, while APIs export JSON. YAML’s indentation is easier to skim. ComTools JSON to YAML (Tools/Json/ToYaml) converts locally in the browser.
Conversion rules (summary)
| JSON | YAML |
|---|---|
| Object | key: with indented children |
| Array | - item lists |
| String | Plain, or quoted if it contains :, #, newlines, etc. |
| Number / boolean / null | As-is |
| Empty object / array | {} / [] |
Indentation is 2 spaces. Risky strings are JSON-quoted to avoid YAML misparsing.
Steps
- Open JSON to YAML.
- Paste JSON (validate first if unsure).
- Click Run and copy YAML into your config file.
Nothing is uploaded.
Example
Input:
{
"name": "ComTools",
"free": true,
"tools": ["json", "excel"],
"user": {
"id": 1,
"name": "admin"
}
}
Output sketch:
name: ComTools
free: true
tools:
- json
- excel
user:
id: 1
name: admin
Common scenarios
| Scenario | Notes |
|---|---|
| JSON config → YAML deploy | Convert, commit to repo |
| Docs readability | Paste YAML into README |
| Need XML instead | JSON to XML |
| From a spreadsheet | CSV/JSON convert then YAML |
Notes
- Valid JSON required—no trailing commas or comments.
- Do not mix tabs into the output (tool emits spaces).
- Review multiline strings and anchors (
&/*) manually if you add them later. - Check boolean casing against your YAML 1.1 vs 1.2 runtime.
Related tools
FAQ
YAML back to JSON?
Use a reverse tool or yq locally; this page is JSON → YAML.
Key order?
Follows object key enumeration—do not rely on order for logic.
vs “YAML beautify” sites?
This generates YAML from JSON structure; it does not re-indent existing YAML.