JSON ↔ YAML Converter
Paste JSON and get equivalent YAML, or paste YAML and get clean JSON — with an error message pointing at the offending text so you can fix a broken manifest fast.
JSON vs. YAML
Both formats describe the same data model: scalars (strings, numbers, booleans, null), ordered lists and key–value maps. JSON is strict and machine-friendly — braces, brackets, quoted keys, no comments. YAML is a superset designed for humans: indentation instead of braces, optional quotes, comments with #, and multi-line strings. Every valid JSON document is also valid YAML, but not the other way round.
Where each one shows up
JSON dominates HTTP APIs, package.json, tsconfig.json, browser storage and most databases. YAML is the configuration language of the cloud-native world: Kubernetes, Helm, Docker Compose, Ansible, GitHub Actions, GitLab CI, CloudFormation, Serverless Framework and OpenAPI/Swagger all use it. Converting between the two is a daily task when you receive an API response and need a manifest, or when a tool only accepts JSON input.
YAML pitfalls the converter helps you catch
Indentation must use spaces, never tabs. Unquoted values like yes, no, on, off and 1.0 may be interpreted as booleans or numbers (the “Norway problem”: NO becomes false). A leading * or & starts an anchor/alias, which this converter does not support (it reports an error). This tool reads unquoted yes/on as plain strings, unlike many YAML libraries, so check the target parser's rules too. Converting to JSON exposes how each value is interpreted, which is a fast way to find out why a config is not behaving.
How to use it
- Paste JSON in the left pane or YAML in the right pane; the other pane updates as you type, or use the JSON → YAML / YAML → JSON buttons.
- If the input is invalid, an error message appears under the editors, quoting the text near the problem.
- Use Copy JSON or Copy YAML. Key order is preserved so the result stays diff-friendly.
Example: a Kubernetes service
This JSON:
{
"apiVersion": "v1",
"kind": "Service",
"metadata": { "name": "web", "labels": { "app": "web" } },
"spec": { "ports": [ { "port": 80, "targetPort": 8080 } ] }
}
becomes the familiar YAML form: apiVersion: "v1", kind: "Service", a nested metadata block, and a ports list introduced by -. Every string is written in double quotes, while numbers such as 80 are not.
Common use cases
- Turning a
kubectl get … -o jsonresponse into a manifest you can commit. - Converting an OpenAPI spec between
openapi.yamlandopenapi.jsonfor different tooling. - Validating a Docker Compose or GitHub Actions file that fails with an unhelpful parse error.
- Loading YAML fixtures into a test that expects JSON, or vice versa.
Behaviour worth knowing before you paste a real file
A few details of this converter differ from what you may expect from a full YAML library. Strings written to YAML are always double-quoted, so version: "1.10" stays exact. When reading YAML, unquoted yes or on are kept as strings, ~ and empty values become null, and 1.10 is read as the number 1.1. If a value must stay text, quote it.
Block scalars (| and >), anchors and aliases are rejected with an error message at the moment, rather than guessed at. Expand those by hand before converting, or use a command-line tool such as yq for files that rely on them heavily.
A short debugging workflow
When a YAML manifest misbehaves, convert it to JSON and read the result. If a list you expected is a string, or a key is missing, the indentation is wrong. If replicas: 3 shows as "3", something quoted it. If a key shows up as null, its value was left blank or its children are indented at the same level as the key.
Frequently asked questions
Will comments survive a YAML → JSON → YAML round trip?
No. JSON has no comment syntax, so comments are dropped when converting to JSON. Anchors and aliases are not supported: the converter reports an error instead of expanding them.
Why are all strings quoted in the YAML output?
The converter always writes strings in double quotes, so values like "true", "null", "1e3" or "2026-01-01" stay strings when loaded later. You can remove quotes by hand where it is harmless.
Does it support multi-document YAML (--- separators)?
No. Paste one document at a time; a file with several --- separated documents is not converted to an array.
Is the data processed on your servers?
No. Conversion runs in your browser; your configuration files are never uploaded.
Why did 1.10 become 1.1 when I converted YAML to JSON?
In YAML an unquoted 1.10 is a number, and numbers do not keep trailing zeros. Write it as "1.10" in quotes if it is a version string.