JSON to YAML Converter
Convert JSON to YAML in your browser. 100% client-side, no upload, no signup. Preserves key order, surfaces row-level parse errors. Supports OpenAPI and Kubernetes config formats.
About the JSON to YAML converter
Common use cases for JSON to YAML
JSON to YAML conversion is most useful when working with config-driven tools like Kubernetes manifests, Docker Compose files, GitHub Actions workflows, Ansible playbooks, and Helm chart values. API responses are typically JSON, but most modern infrastructure tooling expects YAML for human-edited configuration. Pasting JSON here produces ready-to-commit YAML without leaving the browser.
Example conversion (input and output)
Input: { "name": "formatarc", "features": ["json", "yaml"] }. Output: name: formatarc with features listed under an indented block. Curly braces and quoted keys disappear, arrays and nested objects use indentation, and the result is significantly easier to read than the source JSON for human review.
Key syntax differences from JSON
YAML uses indentation instead of braces, and string values usually don't need quotes. YAML supports comments using #, while JSON has no comment syntax — any comments in non-standard JSON input are dropped during parsing. This converter preserves the declared key order, so the YAML output mirrors the structure of the JSON input exactly.
| Aspect | JSON | YAML |
|---|---|---|
| Structure | Braces and brackets | Indentation |
| Strings | Always quoted | Quotes usually optional |
| Comments | Not allowed | Supported with # |
| Key order | Preserved by this tool | Preserved by this tool |
| Best suited for | APIs and data exchange | Config files and CI/CD |
Converting OpenAPI and Swagger specs from JSON to YAML
OpenAPI 3.0 / 3.1 and Swagger 2.0 specifications are often authored or exported as JSON, yet most editors, linters, and CI tools expect YAML. Paste the JSON spec here to get a YAML version that keeps $ref references, path keys, and component ordering intact. Because the converter never sorts keys alphabetically, the spec structure stays valid — avoiding the schema corruption that generic reformatters can introduce. The result is ready for tools like Redoc, Swagger UI, or Spectral linting.
How the conversion works
The tool first validates the JSON, then serializes the resulting object as YAML. Invalid input is rejected with an approximate line reference before conversion runs. Nothing is sent to any server — every step runs in the browser. For a deeper walkthrough of JSON to YAML conversion patterns, see the companion JSON to YAML guide article.
What this converter preserves and what it cannot
It preserves key order, nesting depth, value types (string, number, boolean, null), and array structure. It cannot transfer JSON comments (JSON has none), and the output uses block-style YAML by default for readability. For most Kubernetes, Docker Compose, and OpenAPI workflows, the YAML is ready to use without further editing.
CLI one-liners: yq, Python, and Node.js
Prefer the terminal, or need this inside a CI/CD pipeline? These one-liners produce the same block-style YAML with key order preserved. For a full walkthrough with edge cases like multi-document YAML and block scalars, see the JSON to YAML guide.
yq -P -o=yaml '.' input.json > output.yamlpython -c "import json,sys,yaml; yaml.safe_dump(json.load(sys.stdin), sys.stdout, sort_keys=False)" < input.jsonnode -e "const y=require('js-yaml'),f=require('fs'); console.log(y.dump(JSON.parse(f.readFileSync(0,'utf8'))))" < input.json