JSON to YAML Converter
Paste JSON and get clean YAML for Kubernetes, Docker Compose, GitHub Actions or OpenAPI. Strings that YAML would misread, such as yes, no and 0123, are quoted for you, and your data stays in your browser.
JSON input
YAML output
Your YAML will appear here. Paste JSON on the left or press Load sample.
Options
How to convert JSON to YAML
- Add your JSON. Paste it, drop a .json file onto the page, or press Load sample.
- Check the result. The YAML appears as you type. If the JSON is invalid you get the line, the column and a suggested fix instead.
- Copy or download. Choose a 2 or 4 space indent, then copy the YAML or save it as a .yaml file.
There is no convert button. The output updates whenever the input or an option changes.
Before
{"name": "web", "replicas": 3,
"ports": [80, 443],
"debug": false}After
name: web
replicas: 3
ports:
- 80
- 443
debug: falseWhen a string gets quotes in YAML
JSON always quotes strings. YAML does not, and that is where hand-converted files go wrong: a plain value is read by its look, not by your intent. This converter writes a string without quotes only when a YAML 1.1 or 1.2 parser would read it back as the same string, and quotes it otherwise.
| JSON string | Plain YAML would mean | This tool writes |
|---|---|---|
"yes", "no", "on", "off", "y", "n" | A boolean in YAML 1.1 parsers such as PyYAML and older Kubernetes tooling | "yes" (quoted) |
"NO" (the country code for Norway) | The boolean false, the well-known “Norway problem” | "NO" (quoted) |
"123", "1.5", "1e3" | A number | "123" (quoted) |
"0123", "0x1F" | An octal or hexadecimal number | "0123" (quoted) |
"2025-01-31" | A date or timestamp | "2025-01-31" (quoted) |
"~", "null", "" | Null, or an empty value | Quoted |
"a: b", "x #y", "- item" | A mapping, a comment or a list item | Quoted |
"hello world" | The same string | hello world (plain) |
Quoted strings use JSON escaping, which YAML double-quoted strings accept, so control characters and non-printing characters survive the trip.
Numbers, null and booleans
Numbers are copied as written in your JSON, so a long ID such as 12345678901234567890 and a value such as 1.10 are not rounded or rewritten. The one change is exponent notation: 1E5 becomes 1.0e+5, because plain 1E5 is not a float in YAML 1.1. JSON true, false and null become true, false and null. Empty objects and arrays are written as {} and [].
Where JSON to YAML conversion is used
YAML is a superset of JSON in the current specification, so the same data can be written either way. Many tools simply prefer the YAML form.
- Kubernetes and Helm
- kubectl accepts JSON, but manifests are normally kept as YAML. Convert an API response or a generated manifest into a file you can edit and commit.
- Docker Compose and CI
- Compose files, GitHub Actions workflows and GitLab CI are YAML. Convert a JSON snippet from documentation or a generator into a pipeline file.
- OpenAPI and config files
- OpenAPI descriptions and many application settings are easier to read and comment in YAML. Convert, then add your comments by hand.
- Round trips and review
- YAML diffs read better than minified JSON in code review. Convert, review, then convert back with a YAML to JSON tool when a service needs JSON.
What this converter does
- Private by design
- The conversion runs in your browser with JavaScript. Your JSON is not uploaded, so it is safe to use with configuration that holds internal hostnames or tokens in test data.
- No data changes
- The parser reads the text itself, so large numbers, trailing zeros and escape sequences are preserved. Only the syntax changes.
- Exact error positions
- Invalid JSON is reported with a line, a column and a few lines of context, and Auto-fix repairs the common mistakes.
- Key order is kept
- Keys come out in the order they appear in the JSON unless you choose to sort them.
- Comments are not created
- JSON has no comments, so the YAML has none either. Add them after you convert.
- Related tools
- Need to check or tidy the JSON first? Use the JSON Formatter. Need XML instead? Try JSON to XML.
Frequently asked questions
How do I convert JSON to YAML?
Paste the JSON into the input box or drop a .json file on the page. The YAML appears straight away. Pick a 2 or 4 space indent, then press Copy or Download .yaml.
Is my JSON uploaded to a server?
No. The conversion happens in your browser tab and nothing is sent anywhere. Closing the tab discards the data.
Why are some of my strings in quotes?
Because plain YAML would be read as something else. Words such as yes, no, on and off, numbers in quotes, dates, values with a colon or a hash sign, and strings that start with a symbol are quoted so they stay strings when the YAML is loaded.
What is the Norway problem?
In YAML 1.1 the unquoted value NO is read as the boolean false, so a list of country codes loses Norway. This tool quotes NO, yes, on, off and similar words, so the string survives in both YAML 1.1 and 1.2 parsers.
Will large numbers or decimals change?
No. Numbers are copied exactly as written, so 12345678901234567890 and 1.10 stay as they are. Exponent notation is the only exception: 1E5 is written as 1.0e+5 so every parser reads it as a float.
Does it keep the order of my keys?
Yes. Keys appear in the order they have in the JSON. Turn on the sort option to order them alphabetically at every level. Arrays always keep their order.
What does the block scalar option do?
Strings that contain line breaks are normally written as one quoted line with \n escapes. With the option on, they are written as literal blocks that start with a pipe character, which reads better for scripts and certificates. Strings that cannot be written safely as a block still fall back to quotes.
Can I convert YAML back to JSON?
This page converts JSON to YAML only. YAML has features JSON does not, such as anchors, tags and comments, so a safe reverse conversion needs a separate tool.
Why does my JSON show an error?
JSON is stricter than JavaScript. Trailing commas, single quotes, comments and unquoted keys are not allowed. The error shows the line and column, and the Auto-fix option repairs these common mistakes before converting.
Is there a size limit?
Files up to 100 MB can be loaded, but a browser tab is the limit in practice. Very large documents may take a few seconds, and the text view shows only the first part of a huge result; Copy and Download still give the whole file.