How to use
- Paste JSON on the left, or click Load sample.
- Choose 2 or 4 spaces of indentation. The YAML appears as you type.
- If the JSON is invalid, the error shows the line where it fails.
- Copy or download the YAML, or click Swap direction to convert YAML back to JSON.
Options explained
- Indent
- 2 spaces is the convention for Kubernetes, Compose and GitHub Actions; some teams use 4.
- Quoting
- Values are quoted only when needed — for example strings that contain ": ", start with a special character, or would otherwise be read as a number, boolean or null (such as "yes", "on", "1.0").
- Long strings
- Lines are never wrapped, so long values like URLs and certificates stay on one line and diff cleanly.
Example
JSON:
{"apiVersion":"v1","kind":"Service","metadata":{"name":"web"},"spec":{"ports":[{"port":80,"targetPort":8080}]}}
YAML:
apiVersion: v1
kind: Service
metadata:
name: web
spec:
ports:
- port: 80
targetPort: 8080
Frequently asked questions
Is YAML a superset of JSON?
Since YAML 1.2, almost every JSON document is also valid YAML. Converting to block-style YAML makes the structure easier to read and edit and allows comments, which JSON does not.
Why are some strings quoted in the output?
Without quotes YAML would change their meaning. "on", "yes" and "no" are booleans in YAML 1.1 parsers, "1e3" is a number, and a value containing ": " would start a new mapping. Quoting keeps the value a string.
Does it keep the order of keys?
Yes. Keys appear in the same order as in the JSON input.
Is my data uploaded?
No. Parsing and conversion run in your browser, which matters for configs containing hostnames, tokens or credentials.
Privacy
This tool runs entirely in your browser. Your files and text are processed on your device and are never uploaded to our servers.