JSON to YAML Converter
Convert JSON to YAML online. Preserve structure, comments-free, and ready to paste into Kubernetes or CI configs.
Last updated:
Paste JSON above to convert it to clean YAML instantly. Ideal for turning API payloads or config snippets into Kubernetes, GitHub Actions, or Docker Compose format. Runs locally.
What is JSON → YAML?
YAML is a human-friendly superset of JSON widely used for configuration — Kubernetes manifests, CI pipelines, Docker Compose, and Ansible playbooks. Converting JSON to YAML preserves the exact data structure while switching to YAML's indentation-based syntax, which is easier to read and edit by hand than braces and quotes.
How to convert JSON to YAML
- 1Paste valid JSON into the input pane.
- 2The right pane renders the equivalent YAML using 2-space indentation.
- 3Review the output — YAML omits most quotes and braces, so it's typically shorter.
- 4Copy the YAML into your manifest, workflow, or compose file.
Use Cases
Build Kubernetes manifests
Convert a JSON object into the YAML shape kubectl expects for Deployments, Services, and ConfigMaps.
Author CI/CD pipelines
Turn a JSON config into GitHub Actions or GitLab CI YAML without hand-translating indentation.
Migrate JSON configs
Move an app's JSON settings to YAML for better readability and inline comments (add comments after converting).
Code Examples
Input JSON
{ "name": "web", "ports": [80, 443], "env": { "TZ": "UTC" } }Output YAML
name: web
ports:
- 80
- 443
env:
TZ: UTCKey Concepts
- YAML is a superset of JSON
- Every valid JSON document is also valid YAML 1.2. That's why the conversion is lossless in the JSON → YAML direction.
- Indentation matters
- YAML uses spaces (never tabs) to denote structure. Inconsistent indentation is the most common YAML parsing error.
- Anchors & aliases
- YAML can reuse a block with `&anchor` and `*alias`. JSON has no equivalent, so converting from JSON never produces them.
Tips & Best Practices
- ▸YAML forbids tabs for indentation — always use spaces. This tool outputs 2-space indent, the community standard.
- ▸Strings that look like booleans or numbers (yes, no, 1.0, on) may need quoting in YAML to stay strings.
- ▸Add comments (#) after converting — JSON can't hold comments, so they must be added in the YAML step.
- ▸For Kubernetes, keep one document per file or separate multiple with `---`.
Frequently Asked Questions
Which YAML version is produced?
YAML 1.2, using the widely-supported js-yaml library. Output is compatible with Kubernetes, GitHub Actions, and most modern YAML parsers.
Can I convert YAML back to JSON?
A dedicated YAML → JSON tool is on the roadmap. For now, this page focuses on the JSON → YAML direction.
Related Tools
JSON → TypeScript
Convert JSON to TypeScript interfaces instantly. Generate strongly-typed TS types from any JSON sample.
JSON → Go
Convert JSON to Go structs online. Generates idiomatic Go structs with proper json tags and PascalCase field names.
YAML → JSON
Convert YAML documents to JSON online. Supports YAML 1.2, multi-document streams, and produces pretty-printed JSON output.
JSON → CSV
Convert an array of JSON objects to CSV online. Headers are inferred automatically from all keys across records.
CSV → JSON
Convert CSV data to a JSON array of objects online. Auto-detects delimiter and quotes, preserves numeric types when requested.
Number Base
Convert numbers between binary, octal, decimal, and hexadecimal. Supports arbitrarily large integers using BigInt.