JSON to YAML Converter
Turn JSON arrays or objects into clean, readable YAML. Paste or upload JSON, choose block or flow array style, indentation, and quoting, then copy or download the result — all in your browser.
100% Client-Side Processing
Your JSON is parsed and converted entirely in your browser. Nothing is uploaded to a server.
Options
Table of Contents
What is a JSON to YAML Converter?
A JSON to YAML converter takes structured JSON data — an array of objects, or a single object — and rewrites it as YAML (YAML Ain't Markup Language), the indentation-based data format used for Kubernetes manifests, Docker Compose files, CI/CD pipelines (GitHub Actions, GitLab CI, CircleCI), Ansible playbooks, and countless application configuration files.
The converter walks the JSON structure and maps each key to a YAML mapping entry: object keys become "key: value" lines, arrays become indented list items (or inline flow lists), and strings are automatically quoted only when needed — producing clean, minimal YAML that's easy to read and safe to parse.
How it Works
- Add your JSON: Paste JSON directly into the editor, or upload a .json file.
- Choose your options: Set an indentation size, whether arrays should render as block lists or inline flow lists, and whether string values should be quoted only when necessary or always.
- Read the result instantly: The tool parses your JSON in your browser and shows the converted YAML as you type, along with line and character counts.
- Copy or download: Copy the YAML to your clipboard or download it as a .yaml file.
Features
- Paste JSON or upload a .json file
- Instant, live conversion as you type — no button to click
- Works with a single JSON object or an array of objects
- Block array style (- item per line) or flow style (inline [a, b, c])
- Smart automatic quoting: strings only get quoted when needed (numeric-looking, reserved words, special characters)
- Optional "always quote strings" mode for stricter, more explicit output
- Configurable indentation (2, 4, or 8 spaces — YAML forbids tabs for indentation, so no tab option)
- Correctly nests objects inside arrays and arrays inside arrays
- Empty arrays and objects render as [] and {} instead of being omitted
- Live line and character counts
- 100% client-side processing for privacy
Best Practices
- Leave quoting on "Auto" unless you have a reason not to: auto-quoting keeps the output readable while still safely quoting anything ambiguous, like a string that looks like a number, boolean, or the word "null".
- Use flow-style arrays for short lists of simple values: a list of tags or IDs often reads better as a single inline line than as several block items — flow style only applies to arrays of plain scalars, and automatically falls back to block style for arrays containing objects or nested arrays.
- Watch for numeric-looking strings that must stay strings: values like ZIP codes, phone extensions, or IDs with a leading zero (e.g. "007") get automatically quoted so a YAML parser doesn't reinterpret them as numbers.
- Double-check keys and values containing a colon: a value like "Winner: Best Programmer" is automatically quoted, since an unquoted colon-space sequence would otherwise be read as a nested mapping.
- Validate against your target tool's YAML dialect: most tools (Kubernetes, GitHub Actions, Docker Compose) accept standard YAML 1.1/1.2 as produced here, but always run the output through your target system's own linter or dry-run mode before relying on it in production.
Troubleshooting
It says my JSON is invalid
Check for a trailing comma after the last item in an array or object, unquoted keys, single quotes instead of double quotes, or an unclosed bracket — these are the most common reasons JSON fails to parse.
A string value came out quoted when I didn't expect it
This is intentional and safe: strings that look like numbers, booleans, or the words null/true/false/yes/no (in any case) are automatically quoted so a YAML parser reads them as strings, not as those types.
My array of objects didn't become a flow-style list
Flow style ([a, b, c]) only applies to arrays made entirely of plain scalar values (strings, numbers, booleans, null). Arrays containing objects or nested arrays always use block (multi-line) style, since flow-style objects are much harder to read.
There's no "tab" indentation option
The YAML specification does not allow literal tab characters for indentation — only spaces are valid. That's why this tool only offers 2, 4, or 8-space indentation, not tabs.
Common Use Cases
- Writing Kubernetes manifests: convert a JSON object describing a Deployment, Service, or ConfigMap into the YAML format kubectl expects.
- Generating CI/CD pipeline files: turn a JSON-defined pipeline config into the YAML format required by GitHub Actions, GitLab CI, or CircleCI.
- Migrating application config: convert a JSON config file into YAML for tools and frameworks (Docker Compose, Ansible, Spring Boot) that prefer or require YAML.
- Documenting API responses in a human-friendly format: YAML's lack of brackets and quotes on most values makes it easier to read in documentation than raw JSON.
- Testing YAML-consuming code: quickly generate sample YAML payloads from JSON test fixtures without hand-writing YAML.
Frequently Asked Questions
Yes. A single object converts directly into a YAML mapping. A top-level array converts into a YAML block sequence, with each item as a list entry.
Block style writes one array item per line with a leading dash — the standard, most readable YAML style. Flow style writes the array inline in square brackets, like [a, b, c] — more compact, but only used here for arrays of plain values, never for arrays of objects.
With "Auto" quoting (the default), a string is only quoted when leaving it unquoted would change its meaning — for example, if it looks like a number ("007"), a boolean ("yes"), the word "null", or contains a colon followed by a space. Ordinary strings are left unquoted for readability.
Yes. Switch "String quoting" to "Always quote strings" to wrap every string value in double quotes, regardless of whether it needs it.
Nested objects become indented YAML mappings. Nested arrays and arrays of objects are indented as block sequences, with each object's first key placed on the same line as its dash.
No. Everything happens locally in your browser, and nothing is uploaded or saved.
The converter runs in your browser's memory, so very large JSON files (tens of megabytes or more) may be slow or use a lot of memory depending on your device.