JSON to YAML Converter
Clean Config Files, Safely Quoted
Paste your JSON into the top box, click on "convert" and you’ll have a nice, clean YAML output that can be used in your pipeline, configuration file, or as part of a Kubernetes deployment.
- FreePrice
- YAMLOutput
- NoneSign-up
- In your browserRuns
JSON to YAML Converter
Converted in your browser, with every issue listed
- Records
- 0
- Depth
- 0
- Size
- 0 B
Ready. Paste your data, open a file or try the sample.
| Result | Check | Details |
|---|
Going the other way? Convert YAML to JSON
Guides for this tool
Articles with worked examples, tables and a short video that help you get more from this tool.
YAML or JSON: Which One Fits Your Project?YAML vs JSON compared: the differences, strengths, the same data in both, and when to use which.
9 minutes of reading · video guide inside
Jobs This JSON to YAML Converter Handles for You
This JSON to YAML converter takes any JSON document and writes the same data as YAML. Objects turn into indented keys, arrays into dash lists, and long text into an easy-to-read block. Your browser does the converting, so the data stays with you.
Yaml is expected by many tools, such as Docker Compose, GitHub Actions, Kubernetes, Ansible, etc. on one side and APIs and programs are generally handing you Json. This means that at some point, when settings are traveling from the program to the configuration file, you will need to do this step.
Writing YAML manually seems like a simple task; but many values will silently change their meaning if they are not quoted. The YAML parser understands which values need quoting, and will only quote those particular values. So, the YAML that is parsed will read exactly the same as the original data.
From Brackets to Indentation
In JSON, structure is marked with braces and brackets. YAML uses indentation instead. Each nested object moves two spaces to the right, and each array item starts on its own line with a dash. Empty objects and lists stay short, written as {} and [].
You can select either two space indentation (the standard on most projects) or four space indentation if your team wants more space to work with. No tabs are given in this list, as YAML does not permit them to be used for indentation.
Convert JSON to YAML With Safe Quoting
There are many ways in which strings will appear to be something else to the YAML parser. For instance, the string NO may become the boolean false; the string 1.10 may become the number 1.1; the string 2024-01-01 may become a Date Object. Also, strings that begin with either a hash (#) or an asterisk (*) have a special meaning.

The converter will compare each of the strings you input to the rules mentioned above. This includes the older rules used by tools like PyYAML. If a string is considered "at risk", then it will be placed in double quotes. Otherwise, it will remain as normal text. So, the YAML generated will mean exactly the same as the JSON you entered.
Readable Blocks for Long Text
A JSON string full of \n escapes is hard to read. The converter writes such text as a literal block that starts with a pipe, so each line appears on its own line again. Scripts, certificates and SQL in a config become readable at a glance.

The block keeps the final line break exactly as it was. A string without one gets |-, and a string with extra breaks at the end gets |+, so nothing gets added or lost.
Numbers, Keys and Nulls
The numbers are represented in the same way as they appear in the JSON, so, a 20-digit ID will be represented in its entirety. The booleans and null values are converted to true, false and null. All keys should remain in plain format unless there is a need to represent them with quotation marks, for example, y, n, or yes which are seen by some older users as being boolean as well.
The key ordering always remains the same. Since the YAML file has its keys ordered identically to how they appear in the JSON file, any subsequent diff will be small and easy to read.
As with lists within lists, the formatting follows the exact same pattern. For every level of nesting in a list, there will be one dash added. Objects that appear in lists begin on the same line as the dash that represents the object’s level in the list. This format is the most commonly recommended by various YAML style guides, which means that the resulting file will appear familiar to anyone who views it.
Why Block Style and Not Flow Style
Flow style in YAML (looks like JSON) can also be used, but the converter will use block style, since that’s how people are used to reading config files. Each setting has its own line, so when you make a change it only affects one line and when you do a review it can be short.
The only exception is writing empty objects and empty lists as {} and []. Both are shorter and more clear than having an empty block, and all YAML readers will understand either.
Checks to Run Before Saving the YAML
Scan the YAML file once from top to bottom before you start working with it. The indentation used in the file will allow you to see the structure of the document at a glance. This will help you easily find any settings that are placed in the wrong section. After scanning the YAML file, you can then add comments to any areas where a value needs explanation, since JSON does not allow for comments.
Lastly, allow the owner of the tool to verify the file. To illustrate, perform a dry run on your Kubernetes tool or a configuration check on your Docker Compose tool. Your converter will produce valid YAML, but the tools will work out if each configuration value is correct.
When The JSON Has An Error In It
Before it begins writing, the converter strictly reads the JSON. It will stop at a trailing comma, a comment, or a single quote and give you the exact line and column. After that, "Show me where" will place the cursor on that position.

JSON to YAML Online for Config Work
In addition, CI workflow files give another common scenario. Code-based configuration is exported as JSON and needs a workflow file formatted per the GitHub Actions workflow syntax. As well, Kubernetes gives an example of taking a JSON resource from the cluster and placing it back into a Git repository as YAML.
The output follows the YAML 1.2 specification, so any modern reader accepts it. Want to check the conversion both ways? Paste the result into our YAML to JSON converter and compare.
See the JSON to YAML Converter at Work, Start to Finish
This brief video shows each step from start to finish. Choose your language below, and switch on captions if they help.
Turning JSON Into YAML on Denwix
The YAML appears while you are still pasting.
Paste the JSON
Use the input box, drop a .json file on it, or open one. The sample is a small list of orders.
Pick the indent
Two spaces suit most projects. Choose four if your team prefers more room.
Look over the result
leave the values that have quotes as is because if you don’t then YAML will get confused and might read the values incorrectly.
Take the YAML
Copy it or download a.yaml file, ready to commit.
YAML That Reads Back the Same
The test of a converter is simple: convert back, and you should get the same data.
Quotes only where needed
Risky values get quotes, and ordinary text stays clean and plain.
Safe for old readers too
Dates, yes, no and on stay text even in YAML 1.1 tools.
Readable text blocks
Multi-line strings become pipe blocks instead of long escaped lines.
Exact numbers
Long IDs keep every digit from the JSON.
Key order kept
Keys appear in the original order, so diffs stay small.
Private configs
Hosts, keys and settings never leave your browser.
Rules for Keeping YAML Configs Healthy
Denwix takes care of the syntax. These habits keep the file easy to live with.
- Keep one indent size per file. Mixing two and four spaces makes the structure hard to follow.
- Leave the quotes alone. If the converter quoted a value, removing the quotes may change its meaning.
- Add comments after converting. JSON cannot hold comments, so explain tricky settings in the YAML itself.
- Keep passwords and API keys out of the file altogether. Reference a secret store instead of pasting passwords into YAML.
- Validate before you deploy. Before you ship your file (e.g., using a linter, a dry run), use the tool that will be used with it.
- Use anchors for real repetition. After the conversion process, you may manually use anchors and aliases to replace multiple occurrences of the same block.
- Name keys consistently. Pick one style, such as snake_case, and keep it across the whole file.
- Commit small changes. Because the key order stays stable, each commit shows only what really changed.
Six JSON to YAML Mistakes
Each of these turns correct JSON into YAML with a different meaning.
Bare country codes
An unquoted NO becomes false in many YAML readers.
Bare version numbers
An unquoted 1.10 reads back as the number 1.1.
Dates turned into objects
PyYAML reads a bare 2024-01-01 as a date, not as text.
Tabs in the indent
A tab makes the whole file invalid, even if it looks aligned.
Escaped line breaks
Keeping \n inside one long line makes scripts unreadable.
Symbols at the start
A bare value starting with # or * turns into a comment or an alias.
Questions About the Denwix JSON to YAML Converter
What are the steps to turn JSON into YAML on Denwix?
Paste the JSON into the box, or load the file from your device. The YAML appears beside it, ready to copy or download.
Why does the YAML keep quotes around some values?
In the absence of quotes, YAML will interpret your input as either a boolean value (true/false), a numeric value, or a date. Quotes make sure that the input remains text.
Can I set the YAML indent to two or four spaces?
Yes. Choose an indent of two or four spaces. The list offers no tabs, since YAML does not allow them for indentation.
What happens to long text with line breaks?
Each line is on its own line, the last line break remains unchanged, and the first line begins with a pipe.
Will my keys come out in a different order?
No. Keys appear in the same order as in the JSON, which keeps later diffs small.
Is the result valid for Kubernetes and Docker Compose?
Yes. The result follows the YAML 1.2 standard. Whether the settings themselves are right depends on the tool, so run its own check before you deploy.
Can I get comments in the YAML?
Since JSON cannot contain comments, you can add those comments to the YAML file after conversion, wherever they will be helpful.
If I convert it back, will I get the same JSON?
Yes. The YAML to JSON converter gives an exact copy of your original data because it quotes risky values and maintains the exactness of all numeric values.
Why is a list written with dashes?
Dashes are used as the "block" format for list items in YAML. Since each item begins on a separate line, large lists are much easier to view and revise.
Can I convert JSON to YAML for Ansible or Helm?
Yes. Both use standard YAML. Convert the data below, then use that data in your playbook or values file, adding whatever comments you may need.
What does the pipe symbol mean in the output?
A pipe starts a literal block. Every line below it, indented one level deeper, is part of the same text, and the line breaks stay exactly where they were.
How large a file will this Denwix tool accept?
Files running to several megabytes pose no problem. Very large input converts when you press the button rather than on every key.
Does my JSON ever leave my own device?
No. Only your browser performs the conversion, and nothing goes to this site or any other server.
More Tools for Configs and Data
Useful on either side of the conversion.
- YAML to JSON Converter
Read YAML back as JSON, with anchors resolved.
- JSON Formatter
Find and fix JSON errors before converting.
- JSON to XML Converter
Need XML instead? Convert the same JSON to it.
Ready to Turn Your JSON Into YAML?
Paste the JSON and clean YAML appears straight away. The JSON to YAML converter is free, needs no account and keeps your data in your browser.