JSON to YAML Converter
A free tool by DeepRit, a Google Ads agency that does PPC and nothing else. We build and run Google Ads accounts so every click is accounted for. Book a free audit call
Free JSON to YAML converter. Paste JSON and get clean YAML with safe quoting for values like yes, no, 08 or 1:30, ready for configs, Kubernetes and CI files.
Free, no sign-up. Runs in your browser: nothing you type is uploaded or saved.
How to use the JSON to YAML converter
- Paste your JSON into the box: an object, an array or a single value.
- Read the YAML that appears below, ready to copy.
If the JSON isn't valid, the JSON to YAML converter tells you what's wrong instead of producing broken output. Nothing is sent anywhere: the conversion happens in your browser, so it's safe for configuration files that contain internal hostnames or settings.
Why convert JSON to YAML?
JSON and YAML describe the same kinds of data: objects (maps), arrays (lists), strings, numbers, booleans and null. YAML is designed to be easier for people to read and edit, so it's the usual format for:
- Kubernetes manifests and Helm values files.
- CI/CD pipelines: GitHub Actions, GitLab CI, CircleCI, Azure Pipelines.
- Docker Compose files.
- Ansible playbooks.
- OpenAPI (Swagger) specs.
- Static site generators and app configuration.
APIs, on the other hand, usually return JSON. Converting lets you take data from an API or a JSON config and drop it into a YAML file.
How the conversion works
The JSON to YAML converter parses your JSON with the browser's own JSON parser, then writes it out as YAML 1.2:
- Objects become key: value lines, with nested objects indented by two spaces.
- Arrays become lists with a "- " in front of each item.
- Arrays of objects put the first key on the dash line and the rest indented underneath.
- Empty objects and arrays are written as {} and [].
- Numbers, true, false and null are written as plain YAML values.
Because valid JSON is also valid YAML 1.2, you could paste JSON straight into a YAML file, but the result is much harder to read. The converter gives the clean, idiomatic block style people expect.
Safe quoting: avoiding the "Norway problem"
YAML's flexibility has a famous downside. Some unquoted values are read as something other than text:
- yes, no, on, off, y, n can be read as booleans by YAML 1.1 parsers. A list of country codes containing NO (Norway) becomes false.
- Numbers with leading zeros like 08 or 007 may become numbers or be read as octal.
- Times like 1:30 can be read as sexagesimal numbers (90) by older parsers.
- null, ~ and an empty value become null.
- Text starting with special characters (such as @, `, *, &, !, %, {, [, #) can be misread or cause errors.
The JSON to YAML converter quotes any string that could be misread, using double quotes with JSON-style escapes, so "yes" stays the string yes, "08" stays the string 08 and "1:30" stays the string 1:30. Plain, unambiguous strings like names and paths are left unquoted for readability.
Multi-line strings
Strings containing line breaks are written in double quotes with \n escapes. That's always valid YAML and preserves the exact text. If you prefer YAML's block style (| or >) for long text, you can change those values by hand after converting.
Comments
JSON has no comments, so the YAML output has none either. After converting, you can add comments in YAML with #, which is one of the reasons many teams prefer YAML for configuration.
Checking your JSON first
If you get an error, the JSON may have:
- A trailing comma after the last item: {"a": 1,}
- Single quotes instead of double quotes.
- Unquoted keys: {name: "x"}.
- Comments (// or /* */), which JSON doesn't allow.
The JSON formatter shows exactly where the error is and can tidy the JSON before converting. To go from JSON to a spreadsheet, use the JSON to CSV converter.
YAML gotchas to remember
- Indentation matters, and must be spaces, not tabs.
- Keys are case-sensitive.
- Duplicate keys are errors in strict parsers.
- Anchors and aliases (& and *) let YAML reuse blocks, but aren't produced by conversion from JSON.
Tips
- Validate the output with your tool (kubectl, your CI's linter, docker compose config) before deploying.
- Keep secrets out of version control, whatever the format.
- Use the Copy button to avoid losing indentation.
- For scheduling syntax in CI files, the cron expression generator helps.
Privacy and accuracy
Your JSON stays in your browser. Nothing is uploaded, logged or stored. The JSON to YAML converter uses the browser's standard JSON parser and writes YAML 1.2 with conservative quoting, with no AI involved, so the same JSON always gives the same YAML. Developers, DevOps engineers and data teams use it free on any device.
Kubernetes, Compose and CI examples
Many tools accept either JSON or YAML, but their documentation and examples are almost always in YAML. If you generate configuration from code, it's often easiest to build it as JSON (every language has a JSON library) and then use the JSON to YAML converter to produce a readable version for review or for committing to a repository. For Kubernetes, kubectl accepts both formats; for GitHub Actions, workflow files must be YAML.
Key order and data types
JSON object keys keep their order in the conversion, so the YAML lists keys in the same order you wrote them. Numbers stay numbers, true and false stay booleans, and null stays null. Long integers beyond about 15 digits lose precision when parsed as JSON numbers in a browser, which is a JSON limitation rather than a YAML one. If you need exact large numbers, such as IDs, store them as strings in the JSON first.
Reviewing the output
After converting, read through the YAML once. Check that indentation looks right, that strings which should be text are quoted where needed, and that nothing important was lost. The JSON to YAML converter is designed to be safe by default, quoting anything ambiguous, so the output is often a little more quoted than hand-written YAML, but it will be read exactly as intended.
Quick reference
- Map (object): key: value pairs.
- Sequence (array): items starting with "- ".
- Scalar: a single value: string, number, boolean or null.
- Block style: indentation-based layout, used by the converter.
- Flow style: JSON-like {} and [] layout, used for empty collections.
JSON vs YAML: which to use?
JSON is strict, simple and universally supported, which makes it ideal for APIs and data exchange between programs. YAML is easier for people to read and write, supports comments, and avoids most brackets and quotes, which makes it popular for configuration that humans edit. Many teams use both: JSON for data flowing between systems, YAML for files people maintain. The JSON to YAML converter bridges the two, so you can take data from an API or a generator and turn it into a readable config file in a second, with safe quoting that prevents the most common YAML surprises.
Indentation and copying
YAML depends on indentation, so copy the output with the Copy button rather than selecting text by hand, which can lose leading spaces. If you paste into an editor that converts spaces to tabs, turn that off for YAML files: YAML doesn't allow tabs for indentation.
A worked example
A developer has a JSON config for a service:
{"name": "crumb-api", "version": "1.4.0", "replicas": 3, "debug": false, "env": {"REGION": "us-east", "MODE": "yes"}, "ports": [80, 443], "owners": [{"name": "Ava", "role": "lead"}]}
She pastes it into the JSON to YAML converter and gets:
name: crumb-api
version: "1.4.0"
replicas: 3
debug: false
env:
REGION: us-east
MODE: "yes"
ports:
- 80
- 443
owners:
- name: Ava
role: lead
Notice that MODE: "yes" is quoted, so it stays the string "yes" instead of becoming the boolean true in older YAML parsers. The version "1.4.0" starts with a digit, so it is quoted too, which guarantees every parser reads it as text rather than trying to read it as a number. She pastes the result into her Helm values file and runs her linter, which passes.
Need more customers from Google?
This tool is free and runs in your browser. If your business also needs more leads or sales, Google Ads is where people search with their wallet out. DeepRit is a Google Ads agency that does PPC and nothing else: we build the campaigns, block the searches that waste money, write the ads, set up conversion tracking and send you a short report every week. Request a free PPC audit and we will show you, in dollars, what we would fix first.
Frequently asked questions
How do I convert JSON to YAML?
Paste the JSON into the JSON to YAML converter and copy the YAML it produces.
Is JSON valid YAML?
Yes, JSON is a subset of YAML 1.2, but the block style is easier to read.
Why are some strings quoted?
Because YAML could read them as something else, like a boolean (yes, no) or a number (08).
Can it convert YAML to JSON?
No, this tool converts JSON to YAML only.
Is my data uploaded?
No. The conversion happens entirely in your browser.
Is the JSON to YAML converter free?
Yes, completely free, with no sign-up.
Free PPC audit
See where your ad budget leaks.
We look at your Google Ads account before the call, then walk you through what we'd fix first, in dollars. No obligation, no hard sell.