JSON to YAML
Convert JSON to clean, readable YAML with 2- or 4-space indentation. Strings are quoted only when needed and long lines are never folded. Runs in your browser.
About JSON to YAML
The JSON to YAML converter rewrites JSON as block-style YAML, the indentation-based format used by Kubernetes, Docker Compose, Ansible, GitHub Actions and many application config files. Paste JSON and the YAML appears as you type, with keys in their original order and 2- or 4-space indentation.
Output is produced by the yaml library. Strings are quoted only when they would otherwise be read as another type, such as "true" or "0123", or when they start with a special character, and long strings stay on one line instead of being folded. The input is parsed as strict JSON first, so errors are reported before any YAML is written.
How to use JSON to YAML
- Paste JSON into the input box, or open or drop a .json file.
- Choose 2 spaces or 4 spaces for the YAML indentation.
- Check the output, or fix the JSON if an “Invalid JSON” error appears.
- Copy the YAML or download it as a .yaml file.
Features
- Produces block-style YAML with 2- or 4-space indentation.
- Keeps the key order of the input.
- Quotes strings only when needed to keep them strings, such as "true", "0123" or "a: b".
- Never folds long strings, so URLs and keys stay on one line.
- Writes strings that contain line breaks as literal block scalars (|-).
Common uses
- Turning a JSON API response into a readable Kubernetes manifest or Helm values file.
- Converting tool configuration from JSON to YAML for a CI workflow.
- Writing an OpenAPI spec in YAML from a JSON source.
- Making large JSON structures easier to review in pull requests.
Frequently asked questions
Is every JSON document valid YAML?
Yes, for YAML 1.2: JSON is a subset of it, so a YAML 1.2 parser can read JSON directly. Converting is still useful because block-style YAML is shorter, easier to edit and review, and lets you add comments afterward.
Why are some strings quoted in the output?
A string such as "true", "null" or "123" would be read back as a boolean, null or number if written plainly. The converter quotes these, along with strings that start with characters like *, & or #, so the YAML parses back to exactly the same data.
Will YAML 1.1 tools read the output the same way?
Mostly. The output follows YAML 1.2, which writes strings like yes, no, on and off without quotes. YAML 1.1 parsers, such as PyYAML, read those as booleans. Quote such values manually if your target tool uses YAML 1.1.
Why can’t I choose tabs for indentation?
YAML does not allow tabs for indentation, so only 2 and 4 spaces are offered. Two spaces is the most common convention in Kubernetes manifests and GitHub Actions workflows.
Does the converter add comments or document markers?
No. The output contains only the data, without a leading --- marker or comments. You can add both by hand after converting.
Can I convert JSON to YAML online for free without signing up?
Yes. Use this tool without an account or payment. Files are processed in your browser. Download the result after processing; supported formats and browser requirements are described above. Conversion can change quality, transparency or layout depending on the formats.
Is my input uploaded?
Tools run in your browser. Files, text and results are not uploaded to our servers and are cleared when you leave the tool.
Your privacy comes first
Tools run in your browser. Files, text and results are not uploaded to our servers and are cleared when you leave the tool.