JSON to YAML Converter
Convert JSON documents into clean block-style YAML, ready for config files and pipelines.
JSON and YAML are two spellings of the same data model, and moving between them is routine for anyone who takes an API response and turns it into a config file. YAML's indentation-based style is friendlier in files you edit by hand, which is why docker-compose, Kubernetes and CI pipelines all use it. This converter produces clean block-style YAML from any JSON document.
Paste your JSON and press Convert. Objects become nested mappings, arrays become sequences, and scalars keep their types - numbers stay numbers, booleans stay booleans, strings are quoted only when YAML would misread them. The output is formatted with proper indentation and no awkward flow brackets, so it reads like a hand-written config.
The conversion runs in your browser using a standard YAML library, so the output matches what tools like docker-compose and GitHub Actions actually accept. Nothing is uploaded, which keeps configs and any secrets they contain on your machine.
Features
- Clean block-style YAML with proper indentation - no flow-style brackets.
- Types preserved: numbers, booleans, null and strings round-trip correctly.
- Strings quoted automatically only where YAML would otherwise misread them.
- Works for nested objects, arrays and mixed documents at any depth.
- Output validated against the same YAML standard that config tools use.
- One-click copy or download as a .yaml file.
- Fully offline - the JSON never leaves your browser.
How to Use
- 1
Paste JSON
Enter any valid JSON document - an object, array or scalar at the top level.
- 2
Convert
Press Convert to YAML. Objects become nested mappings and arrays become indented sequences.
- 3
Review the output
Check that strings that need quoting were quoted and types survived the trip. The tool handles this automatically.
- 4
Copy or download
Copy the YAML into your config file, or download it as .yaml for a pipeline or compose file.
Example
Object to block YAML
{
"version": "1.0",
"services": {
"web": { "port": 3000 }
}
}↓
version: "1.0"
services:
web:
port: 3000Array of objects
{
"rules": [
{ "path": "/health", "timeout": 5 }
]
}↓
rules:
- path: /health
timeout: 5Common Problems
Losing types in the conversion
A careless converter turns every value into a quoted string, breaking docker-compose ports and pipeline logic. This converter preserves number, boolean and null types, so the output behaves exactly like the JSON.
Flow-style YAML that is hard to read
Some converters emit { } and [ ] flow syntax, which defeats the purpose of YAML readability. This converter always writes block style with real indentation.
Strings that YAML would misread
A string like "yes", "null" or "1.2.3" can be interpreted as a different type by YAML parsers. The converter quotes such values automatically so they survive as strings.
Top-level arrays or scalars
YAML handles a top-level array or scalar fine, but some tools expect a mapping at the root. If your config tool rejects a non-mapping root, wrap the document in an object first.
Hand-converting large documents
Manual conversion of a deeply nested config is slow and error-prone. The converter handles any depth consistently and produces the same indentation a careful author would write.
Secrets embedded in configs
A YAML file that contains passwords or keys is plaintext regardless of format. The converter runs locally, but storing secrets in any committed config - JSON or YAML - still needs a proper secrets manager.
Numbers that should stay strings
A JSON string like "80:80" stays a string in YAML, but a bare JSON number 3000 stays a number. If a downstream tool expects a quoted value, the source JSON determines it - quote it there if the type matters.
Technical Details
The conversion uses the standard YAML library and emits block mappings and sequences: object entries become key: value lines, and arrays become indented lines starting with a dash.
Types are preserved through the conversion. A JSON number stays an unquoted YAML number, a boolean stays true/false, and null becomes null or an empty value depending on context.
Strings are quoted only when a plain scalar would be misread - for example a value that looks like a number, boolean, date or null. Everything else stays readable plain text.
Long values are not flow-wrapped, so deeply nested documents keep their block structure and remain diffable in code review.
Processing is local and synchronous. The JSON is parsed and serialized in your browser and never transmitted.
The serializer follows YAML 1.2 conventions, so booleans appear as true/false, null appears as null or an empty scalar, and numbers are emitted without unnecessary quoting.
Because the JSON is already structured, the conversion is deterministic: the same input always produces the same YAML, byte for byte, which makes generated configs diff-stable in code review.
Frequently Asked Questions
Why is my string output with quotes?
Because YAML would otherwise misread it. A value like "yes", "null" or "2026-08-15" has a special meaning as a plain scalar, so the converter quotes it to guarantee it stays a string.
Is the YAML valid for docker-compose?
Yes. The output follows the same YAML 1.2 core semantics that docker-compose, Kubernetes manifests and CI pipelines parse, and it is emitted in block style with correct indentation.
Does the conversion preserve key order?
Yes. The output keeps the key order of the input document, which matters when order is meaningful for readability or for tools that do not sort keys.
What happens to a top-level array?
It converts to a top-level YAML sequence - a list of dashes with no leading mapping. If your consuming tool requires a mapping root, wrap the array in an object first.
Is my data uploaded?
No. The conversion happens entirely in your browser. The JSON is parsed locally and never transmitted, stored or logged.
Can I convert back?
Yes - use the YAML to JSON converter, which reverses the process. Together the two tools round-trip any document.
Why does my config use different quoting than other tools?
Quoting follows YAML's own rules: only strings that a parser would misread get quotes. That is the minimal, standards-correct output - tools that quote everything are technically valid but much harder to read.
Can I control the indentation?
The output uses standard two-space indentation, which matches the overwhelming majority of hand-written and tool-generated YAML. Most config tools accept any consistent indentation.
Data & Privacy
Your data stays in your browser. Nothing is uploaded.
- Processing
- Local
- Upload
- None
- Server Storage
- None
- Account
- Not required
Related Tools
JSON Formatter
Format, validate and beautify JSON directly in your browser.
JSON & Data
JSON Validator
Validate JSON and pinpoint the first error with a line, column and plain-English explanation.
JSON & Data
JSON Minifier
Compress formatted JSON into a single compact line and see exactly how many bytes you save.
JSON & Data
JSON Diff
Compare two JSON documents and see every added, removed or changed value with its exact path.
JSON & Data
JSON to CSV Converter
Convert a JSON array of objects into a CSV file with automatic headers and proper escaping.
JSON & Data
CSV to JSON Converter
Convert CSV files into a clean JSON array, with optional automatic type detection.
JSON & Data