JSON to YAML Converter — Transform JSON Data to YAML Format
The Kubernetes docs show a JSON example but your manifest file needs YAML — this JSON to YAML converter handles it in one paste. Curly braces and quotes disappear; indentation and colons take their place: {"name":"nginx","port":80} becomes "name: nginx port: 80". DevOps engineers use it to convert JSON API snippets into docker-compose.yml and GitHub Actions workflows, developers use it to write OpenAPI specs, and data teams use it for Airflow and dbt configs. No signup needed.
What Is JSON to YAML Converter?
A JSON to YAML converter transforms JSON data into YAML format — taking structured JSON with curly braces, square brackets, and quoted strings and converting it to YAML's cleaner, indentation-based syntax. JSON and YAML represent the same data structures; YAML is simply easier for humans to read and write, which is why it is the default configuration format for Docker Compose, Kubernetes, GitHub Actions, Ansible, and most modern DevOps tools.
Paste your JSON and get valid YAML output instantly. The converter handles nested objects, arrays, strings, numbers, booleans, and null values — producing properly indented YAML that is ready to use in configuration files.
{"name":"John","age":30}→name: John
age: 30Before & After: JSON to YAML Converter Examples
Real input → output pairs showing exactly what this tool does to your text.
| Input | JSON to YAML Converter Output |
|---|---|
{"name":"nginx","port":80} | name: nginx
port: 80 |
{"tags":["web","api","v2"]} | tags:
- web
- api
- v2 |
{"active":true,"count":null} | active: true
count: null |
{"url":"https://example.com"} | url: "https://example.com" |
{"a":{"b":{"c":1}}} | a:
b:
c: 1 |
Key Features
YAML 1.2 (2009, yaml.org) formally defines JSON as a valid subset of YAML — all valid JSON is valid YAML 1.2. This converter produces YAML 1.2-compliant output: 2-space indentation, unquoted safe strings, quoted strings when values contain YAML-special characters (: # & * ? | < > { } [ ]), and null/true/false without quotes.
Curly braces, square brackets, double quotes around keys, and commas between values all disappear. {"name":"nginx","port":80} becomes the three-character pair "name: nginx" — readable at a glance. Kubernetes, GitHub Actions, and Ansible chose YAML specifically because the reduced punctuation makes large config files manageable.
Output matches the indentation style and quoting conventions expected by Kubernetes kubectl apply, Docker Compose, GitHub Actions .yml, Ansible playbooks, Helm values.yaml, and OpenAPI spec files — ready to paste or save as .yaml without further editing.
No upload, no account. Paste your JSON, copy the YAML — your config data stays on your device.
When to Use JSON to YAML Converter
Use when migrating configuration from JSON to YAML, writing Kubernetes manifests, GitHub Actions workflows, or any YAML-based config file.
All valid JSON converts to YAML. Nested objects use indentation, arrays use - prefix. Strings with special characters are automatically quoted.
Who Should Use This Tool?
Convert JSON configuration snippets to YAML for Docker Compose, Kubernetes manifests, and Ansible playbooks.
Transform JSON API responses or config files to YAML when working with tools that prefer or require YAML format.
Convert JSON data structures to YAML for use in data pipeline configurations and workflow definitions.
Industry Standard
YAML (YAML Ain't Markup Language) was created by Clark Evans, Ingy döt Net, and Oren Ben-Kiki in 2001. YAML 1.2 (2009) defines JSON as a valid subset of YAML, meaning all JSON is valid YAML 1.2. The YAML specification is maintained at yaml.org. Docker Compose, Kubernetes (CNCF), GitHub Actions, Ansible, Helm, and OpenAPI all adopted YAML as their primary configuration format. The go-yaml and PyYAML libraries are the most widely used YAML parsers; js-yaml is the standard for JavaScript.
Key Use Cases
- →Convert a JSON config snippet from documentation into a YAML file for Docker Compose or Kubernetes.
- →Transform a package.json or tsconfig.json section into YAML for a GitHub Actions workflow.
- →Convert JSON API response examples to YAML for OpenAPI/Swagger specification files.
- →Transform JSON environment configuration to YAML for Ansible or Terraform variable files.
- →Convert JSON schema definitions to YAML format for use in API documentation tools.
JSON to YAML Converter vs Other Formats
How this tool compares to related approaches and methods
| Method / Format | Best For |
|---|---|
| THISThis tool | Quick one-off conversion of a JSON snippet to YAML for copy-paste into a config file |
| js-yaml npm package | Node.js automation scripts, CI tools, and programmatic YAML generation |
| Python PyYAML yaml.dump() | Python scripts and Ansible automation — PyYAML is pre-installed in most environments |
| yq command-line tool | Terminal-based conversion in shell scripts; supports in-place YAML editing and querying |
JSON to YAML Converter Rules: How It Works
- →JSON objects {} → YAML key: value pairs, indented with 2 spaces per nesting level.
- →JSON arrays [] → YAML list items prefixed with "- " (dash space).
- →JSON strings → unquoted YAML strings when safe; quoted when the value contains : # & * ? | < > { } [ ] , or starts with special characters.
- →JSON numbers, booleans (true/false), and null → written as-is in YAML without quotes.
- →JSON null → YAML null or ~ (tilde) — both are equivalent.
- ×YAML is indentation-sensitive — spaces only, no tabs. Editing the output requires keeping indentation consistent.
- ×YAML special characters (: # &) in string values must be quoted — the converter handles this, but manual edits may introduce errors.
- ×YAML supports comments (# this is a comment) — JSON does not. Comments can be added to YAML output after conversion.
- ×YAML anchors and aliases (&anchor / *alias) have no JSON equivalent — they must be added manually if needed.
Where It's Applied
How to Use JSON to YAML Converter
- Paste or type your text into the Input Text box.
- The result appears instantly on the right.
- Click Copy to copy the output to your clipboard.
- Click Clear to reset and process new text.
This Converter vs Manual Methods
Why use this tool instead of doing it by hand?
| Method | Limitation |
|---|---|
| Manually rewriting JSON syntax as YAML | Error-prone: easily misses quoting requirements for special characters; impossible for large nested structures |
| js-yaml in Node.js | Requires Node.js + npm install js-yaml for a one-off task |
| Python yaml.dump(json.loads(s)) | PyYAML produces YAML 1.1 output by default — may differ from YAML 1.2 tools (Kubernetes uses YAML 1.2) |
| yq CLI | Requires yq installation; unfamiliar syntax for non-shell users |
| ✓ BESTThis tool | None |
Common Mistakes & Pro Tips
- !Forgetting that YAML is indentation-sensitive — the converter outputs correct indentation, but manually editing the output requires keeping spaces consistent (tabs are not allowed in YAML).
- !Assuming all JSON is valid YAML — JSON is a subset of YAML 1.2, but YAML has reserved characters (like : and #) that need quoting in string values. Always validate the output in your YAML tool.
- !Using PyYAML (Python) for Kubernetes or GitHub Actions YAML and getting unexpected type coercions — PyYAML uses YAML 1.1 by default, which has notorious quirks: "NO", "OFF", "YES", "ON" are parsed as booleans (the "Norway problem" — the country code "NO" becomes false). YAML 1.2 fixed this: only "true" and "false" are booleans. For Kubernetes and GitHub Actions, which use YAML 1.2 or a strict subset, use ruamel.yaml (Python YAML 1.2 library) or js-yaml (Node.js YAML 1.2) to avoid YAML 1.1 compatibility surprises.
Frequently Asked Questions
Everything you need to know about JSON to YAML Converter
What is the difference between JSON and YAML?
+
JSON uses curly braces for objects, square brackets for arrays, and requires quoted strings. YAML uses indentation for structure, colons for key-value pairs, dashes for list items, and mostly allows unquoted strings. Both represent the same data. YAML is more human-readable; JSON is more universally supported in APIs.
Which tools use YAML format?
+
YAML is the native format for: Docker Compose (docker-compose.yml), Kubernetes manifests, GitHub Actions workflows (.github/workflows/), Ansible playbooks, Helm charts, Netlify and Vercel configuration, Jekyll and Hugo static site configs, OpenAPI specifications, CircleCI and TravisCI configs, and most modern DevOps tooling.
Is JSON valid YAML?
+
JSON is a subset of YAML 1.2, meaning valid JSON is also valid YAML. However, the reverse is not true — YAML has features that JSON does not (comments, anchors, multi-line strings). For this reason, most YAML parsers can read JSON files directly.
Can I convert YAML back to JSON?
+
Yes — use the JSON Formatter tool, which can parse YAML-style input, or use a dedicated YAML-to-JSON converter. Since JSON and YAML represent the same data structures, conversion in both directions is lossless for simple key-value and array structures.
Why does Kubernetes use YAML instead of JSON?
+
Kubernetes supports both JSON and YAML, but YAML is the standard because it is more human-readable and writable, supports comments (which JSON does not), and requires less punctuation. Kubectl manifests, Helm charts, and Kubernetes documentation all default to YAML for these reasons.
What is the "Norway problem" in YAML 1.1 and how does YAML 1.2 fix it?
+
In YAML 1.1 (the version most libraries implemented through the 2000s–2010s), the following words are parsed as booleans: true/false, yes/no, on/off (and their uppercase variants YES/NO, TRUE/FALSE, ON/OFF). This means the ISO 3166 country code "NO" (Norway) is parsed as false — causing data corruption in any YAML map keyed by country code. Similarly, "OFF" state labels and "ON" switches become booleans. YAML 1.2 (2009) fixed this: only "true" and "false" (lowercase) are booleans; "yes", "no", "on", "off" are plain strings. Kubernetes, GitHub Actions, and most modern tools use YAML 1.2. PyYAML still defaults to YAML 1.1 — use ruamel.yaml for YAML 1.2 compliance in Python.
How do I convert YAML back to JSON?
+
Use a YAML-to-JSON converter or a local command: Node.js: require("js-yaml").load(yamlString) gives a JS object; JSON.stringify(obj, null, 2) gives formatted JSON. Python: import yaml, json; json.dumps(yaml.safe_load(yamlString), indent=2). Command line with yq: echo "name: nginx" | yq -o=json. For a quick paste-and-convert without code, look for a YAML to JSON online converter. Note: YAML features without JSON equivalents (comments, anchors, custom types) are lost in the conversion.