YAML to JSON Converter
Convert between YAML and JSON in either direction.
Converted successfully.
About this tool
Convert configuration between YAML and JSON in either direction. Handy when a tool expects one format but your config lives in the other — Kubernetes manifests, GitHub Actions workflows and OpenAPI specs being the usual suspects.
How to use it
- Choose YAML to JSON or JSON to YAML.
- Paste your document into the input pane.
- Copy the converted output or download it.
The YAML features JSON cannot represent
Converting YAML to JSON is lossy in ways that are easy to miss until something breaks.
Comments vanish. JSON has no comment syntax, so every # line is gone and cannot come back. If your config is documented in comments, keep the YAML as the source of truth.
Anchors and aliases are expanded. YAML lets you define a block once and reuse it with &defaults and *defaults. JSON has no references, so the block is duplicated at every use. The data is identical; the file is larger and the link between them is lost.
Multiple documents become an array. A file with --- separators holds several documents. Since JSON has no equivalent, they are converted to a JSON array — one element per document.
Dates may become strings. YAML has a native timestamp type, JSON does not. Anything that looks like a date comes out quoted.
Why your indentation is being rejected
Almost every YAML parse error is whitespace, and the message rarely says so directly.
Tabs are illegal. YAML forbids tab characters for indentation, full stop. An editor set to insert tabs will produce files that fail with confusing errors about unexpected tokens. Set your editor to spaces for .yml and .yaml.
Indentation must be consistent within a block. YAML does not care whether you use two spaces or four, but it cares a great deal that you do not switch mid-block.
A missing space after the colon breaks it. key:value is a single scalar string. key: value is a mapping. The space is required.
Unquoted strings can change type. The classic case is no, off and yes, which older YAML versions read as booleans — the reason Norway's country code NO became false in enough config files to earn a nickname. Quote anything that could be misread.
Frequently asked questions
- Which YAML version is supported?
- YAML 1.2 core schema, including anchors, aliases, multi-line block scalars and multiple documents separated by ---.
- Why did my YAML comments disappear?
- JSON has no comment syntax, so comments cannot survive the round trip. Converting back to YAML produces a clean document without the original comments.
- Can I paste a config containing secrets?
- The conversion is local, so nothing is transmitted. That said, a Kubernetes manifest or CI config often holds real credentials — treat the browser tab the way you would treat the file itself.