"category": "format-converter",
JSON to YAML Converter
"tldr": Paste JSON and get clean, idiomatic YAML with 2-space indentation - ready for Kubernetes manifests, CI pipelines, and config files.
Convert JSON into clean, readable YAML - the format used by Kubernetes manifests, GitHub Actions workflows, Docker Compose, and most modern configuration files. Nested objects become indented blocks, arrays become dashed lists, and strings are quoted only when YAML requires it.
Output uses standard 2-space indentation and is valid YAML 1.2, so you can paste it directly into your kubectl manifests or CI pipeline. Conversion runs entirely in your browser, making it safe for configs that contain secrets or internal hostnames.
How to convert JSON to YAML
- 1Paste your JSON configuration into the input panel.
- 2The converter validates the JSON first - syntax errors are reported with the exact position.
- 3Valid JSON is converted to YAML with 2-space indentation and minimal quoting.
- 4Copy the YAML or download it as a .yaml file for your deployment or pipeline.
Convert JSON to YAML in code
import json, yaml # pip install pyyaml
with open("config.json") as f:
data = json.load(f)
print(yaml.dump(data, default_flow_style=False, sort_keys=False))import yaml from "js-yaml"; // npm install js-yaml
const data = JSON.parse(jsonString);
const output = yaml.dump(data, { indent: 2 });Frequently asked questions
Is every JSON document valid YAML already?
Technically yes - YAML 1.2 is a superset of JSON, so a parser will accept raw JSON. But nobody wants to read JSON inside a YAML file. This converter produces idiomatic block-style YAML with indentation and dashes, which is what tools and reviewers expect.
Why did some of my strings get quotes and others did not?
YAML only requires quotes when a value would otherwise be misinterpreted - strings like "true", "no", "3.0", or values with special characters. The converter adds quotes exactly where needed and omits them elsewhere for readability.
Can I use the output in Kubernetes manifests?
Yes. The output is standard YAML 1.2 with 2-space indentation, which kubectl, Helm, and every major CI system accept. A common workflow is fetching JSON from an API and converting it to YAML for a manifest or values file.
Does the converter preserve key order?
Yes, keys appear in the YAML output in the same order they appear in your JSON input, which keeps diffs clean when you are migrating existing config files.
Last updated:
You might also need
Free and in-browser, like everything on JSON Console. Browse all tools →