JSON to YAML Converter
ConvertersConvert JSON to YAML or YAML to JSON — preserves structure, nested objects. Free, private — all processing in your browser.
Convert JSON to YAML and back. Paste JSON to get clean, indented YAML — handy for turning an API response or config object into a docker-compose or Kubernetes-style file — or paste YAML to get JSON when you need to feed it to something that only speaks JSON. There's a "Load sample" button with a realistic docker-compose example so you can see the shape of the output immediately.
JSON and YAML describe the same kind of data — objects, arrays, strings, numbers, booleans — just with different syntax. JSON uses braces, brackets, and quotes; YAML uses indentation and is easier to read and hand-edit, which is why so many config files (CI pipelines, container orchestration, static-site front matter) use it. Converting between them is a common chore when you're moving config from one tool to another.
Press Convert to run the transformation. The two directions are separate tabs so you always know which way you're going.
How to use the JSON to YAML Converter
- 1
Paste your input
Drop in JSON or YAML. Tool auto-detects the format.
- 2
Choose direction
JSON → YAML or YAML → JSON. Switch with a single click.
- 3
Set indentation
2 or 4 spaces typically. Match your project's style.
- 4
Pick quote style (YAML output)
Double quotes universal, single quotes for strings with special characters, unquoted when safe.
- 5
Copy or download
Copy output to clipboard or download as .json, .yaml, or .yml file.
JSON to YAML Converter — examples
Simple JSON to YAML
Basic object conversion.
{
"name": "Jane Doe",
"age": 36,
"admin": true
}name: Jane Doe age: 36 admin: true
Nested structure
Deeply nested object with arrays.
{
"user": {
"name": "Jane",
"roles": ["admin", "editor"],
"meta": {
"created": "2026-05-05"
}
}
}user:
name: Jane
roles:
- admin
- editor
meta:
created: "2026-05-05"Kubernetes deployment (JSON to YAML)
Common DevOps use case.
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"name": "my-app"
},
"spec": {
"replicas": 3,
"selector": {
"matchLabels": {
"app": "my-app"
}
}
}
}apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 3
selector:
matchLabels:
app: my-appYAML to JSON
Reverse direction — for API consumption.
version: '3.8'
services:
web:
image: nginx:latest
ports:
- "80:80"{
"version": "3.8",
"services": {
"web": {
"image": "nginx:latest",
"ports": ["80:80"]
}
}
}Array of objects
List of structured items.
[
{"name": "Alice", "age": 30},
{"name": "Bob", "age": 25}
]- name: Alice age: 30 - name: Bob age: 25
Null and boolean
Type preservation.
{
"enabled": true,
"disabled": false,
"missing": null
}enabled: true disabled: false missing: null
What the JSON to YAML Converter can do
Bidirectional conversion
JSON → YAML and YAML → JSON with one click. Toggle between directions as needed.
Preserves data types
Booleans, nulls, numbers, strings, arrays, objects — all round-trip correctly between formats.
Configurable indentation
2 spaces (common), 4 spaces, or tab. Match your project's style guide.
Block or flow style
Block style (indented, multi-line) is the YAML default. Flow style (compact, JSON-like) for inline data.
Syntax validation
Invalid JSON or YAML is detected with a clear error message and line number.
Quote style options
Choose double quotes, single quotes, or unquoted when safe. Match your team's YAML conventions.
Handle large files
Multi-megabyte configs process without issue. Kubernetes manifests, OpenAPI specs, all work.
100% client-side
Your configs never leave the browser. Safe for production configs, credentials in manifests, internal data.
Where this helps
DevOps and infrastructure
- →Kubernetes manifests: K8s requires YAML but many tools generate JSON. Convert API responses from `kubectl ... -o json` to YAML for editing.
- →Docker Compose: Convert a compose.yaml to JSON for scripting, or generate YAML from JSON config templates.
- →Ansible playbooks: Convert configuration data from JSON (pulled from APIs) to YAML for Ansible playbooks.
- →Terraform converts: While Terraform uses HCL, some workflows require YAML/JSON conversion for data inputs.
CI/CD configuration
- →GitHub Actions workflows: Workflows are YAML. Convert existing JSON pipelines to YAML when migrating.
- →GitLab CI: Similar to GitHub Actions — YAML configs. Convert for migration or tooling.
- →CircleCI config: YAML-based. Convert from other formats for migration.
- →Azure Pipelines: YAML config. Convert for portability.
API and documentation
- →OpenAPI / Swagger specs: Both JSON and YAML formats supported. Convert between them depending on tool preferences.
- →GraphQL schema translations: Some GraphQL tools generate schema in JSON; convert to YAML for readability.
- →Jekyll / Hugo front matter: Static site generators use YAML front matter. Convert from JSON APIs for content imports.
Config management
- →Migrate configs between formats: Tools often support both; convert for your preferred format.
- →Readability: YAML is more readable than JSON for complex configs — convert when editing.
- →Version control readability: YAML diffs are cleaner than JSON diffs — convert before committing config files.
Technical details
JSON-to-YAML parses your input with the browser's strict JSON parser, then serializes it to YAML: nested objects and arrays are indented two spaces per level, multi-line strings use the YAML block scalar (the pipe |), and strings that could be misread as something else — ones containing colons or hashes, leading/trailing spaces, or values that look like numbers, booleans, or null — are quoted so they round-trip correctly. Keys that aren't simple identifiers get quoted too.
YAML-to-JSON uses a lightweight, indentation-based parser that handles the common cases: nested maps, sequences with the dash notation, scalars, quoted strings, inline flow arrays, and comments. It is not a full YAML 1.2 implementation. Advanced YAML features — anchors and aliases (&/*), multiple documents (---), complex multi-line block scalars, merge keys, and tags — aren't supported and can produce wrong output or an error. For those, a dedicated YAML library is the right tool. Everything runs locally in your browser.
Troubleshooting
⚠YAML-to-JSON is not a full YAML parser
It handles common indentation-based maps, sequences, and scalars, but not anchors/aliases, multiple documents (---), merge keys, or tags. Complex YAML may convert incorrectly or error out.
⚠JSON must be strictly valid
The JSON-to-YAML direction uses the strict JSON parser. Trailing commas, comments, or single quotes will fail. Fix the JSON first — a JSON formatter will point to the error.
⚠Indentation is everything in YAML
When editing YAML input, inconsistent indentation changes the structure or breaks parsing. YAML uses spaces (never tabs) and the indent level defines nesting — a misaligned line silently changes the meaning.
⚠Ambiguous strings get quoted
Values like 'true', '3.14', or 'yes', and strings with colons or leading spaces, are quoted in the YAML output so they aren't misread as booleans, numbers, or new keys. That's correct behavior, not clutter.
⚠Round-tripping isn't always byte-identical
Converting JSON to YAML and back (or vice versa) preserves the data but may change formatting, quoting, and key order. The meaning is the same; the exact text won't necessarily match the original.
How it compares
For everyday config conversion — an object to a compose file, a small YAML block to JSON — this is quick and stays in your browser. The JSON-to-YAML direction is the more robust one, since it's backed by the strict JSON parser and a careful serializer that quotes ambiguous values.
The YAML-to-JSON direction is intentionally a pragmatic parser, not a spec-complete one. If your YAML uses anchors, multiple documents, or elaborate block scalars, use a real YAML library (like js-yaml) or a language runtime instead — they implement the full YAML 1.2 spec. Think of this as a fast converter for straightforward files, not a validator for complex YAML.
Frequently asked questions about the JSON to YAML Converter
▶What's the difference between JSON and YAML?
They represent the same data structures. JSON uses braces, brackets, and quotes and is compact and universal. YAML uses indentation, is easier for humans to read and edit, and is common for config files. Converting changes the syntax, not the data.
▶Why are some of my strings quoted in the YAML output?
To keep their meaning. A value like 'true', a number-looking string, or text with a colon would be misinterpreted by a YAML parser if left bare, so the tool quotes it. This ensures the YAML converts back to the same JSON.
▶Can it handle any YAML file?
No. The YAML-to-JSON direction covers common maps, sequences, and scalars but not advanced features like anchors, aliases, multiple documents, or complex block scalars. For those, use a full YAML library such as js-yaml.
▶Why does my JSON fail to convert?
Because it isn't strictly valid JSON. Trailing commas, comments, and single-quoted strings aren't allowed. Run it through a JSON formatter to find and fix the syntax error, then convert.
▶Does converting preserve key order?
The data is preserved, but exact formatting, quoting, and sometimes key order may differ from the original. The result is equivalent data, not a byte-for-byte copy of the input.
Further reading
- YAML 1.2.2 Specification — Official YAML spec.
- JSON Specification (RFC 8259) — IETF JSON standard.
- The Norway Problem — Why YAML 1.1 is dangerous for certain string values.
- yaml-multiline.info — Guide to YAML multi-line string styles.
- Kubernetes YAML Reference — How Kubernetes uses YAML.
Related tools
All ConvertersCSV to JSON Converter
Convert CSV files to JSON arrays or objects with custom delimiters
JSON Formatter
Format, validate, and beautify JSON instantly in your browser
JSON to CSV
Flatten nested JSON into CSV rows — ready for Excel, Google Sheets, analysis
JSON to TypeScript
Generate TypeScript interfaces and types from JSON — handle nested, optional, arrays
JSON to XML Converter
Convert between JSON and XML — for SOAP APIs, legacy integration, data migration
JSON Validator
Validate JSON syntax and schema — pinpoint errors by line and column
Learn more
Explore more tools
200+ free tools that run in your browser.
Browse all tools →