Developer Tools
YAML ↔ JSON Converter
Convert YAML to JSON and JSON to YAML for Kubernetes, Docker Compose, GitHub Actions and other config files.
How to use
- 1Choose the direction (or leave it on auto-detect).
- 2Paste your YAML or JSON and copy the converted result.
Frequently asked questions
Is every YAML file convertible to JSON?
Almost. JSON has no comments, anchors or custom tags, so comments are dropped and anchors are expanded into copies.
Can it handle multiple YAML documents?
Yes. Files with several documents separated by --- become a JSON array, one item per document.
Why do 'yes' and 'no' stay as strings?
We follow YAML 1.2, where only true and false are booleans. YAML 1.1 treated yes/no/on/off as booleans too.
Auto-detect is a one-character heuristic, and it's deliberate
Left on 'Auto-detect', the direction is decided by testing whether the trimmed input starts with `[` or `{` — if so it's treated as JSON and converted to YAML, otherwise as YAML converted to JSON. That's a cheap, reliable test in practice because valid JSON always starts with one of those two characters, while YAML almost never does (even a YAML document that happens to be a flow-style list would need to start with `[`, which is rare for hand-written config). If you ever get the wrong direction, the explicit YAML→JSON / JSON→YAML options bypass the heuristic entirely.
The YAML 1.2 boolean decision is the thing most likely to surprise you
This converter is built on the `yaml` package's YAML 1.2 parsing, which only treats literal `true`/`false` as booleans — `yes`, `no`, `on`, `off`, and `y`/`n` all stay as plain strings. That's a deliberate spec change from YAML 1.1 (which Python's PyYAML and older tools still follow), and it matters most for Kubernetes and Ansible configs written against the older convention, where a bare `enabled: yes` will come through here as the string `"yes"`, not the boolean `true` — worth double-checking if the converted JSON feeds something that cares about the type.
What doesn't survive the round trip
JSON has no comments, anchors, or custom tags, so converting YAML with `&anchor`/`*alias` references expands each reference into a full independent copy of the referenced data rather than preserving the shared structure, and any `#` comments in the source are simply dropped — both expected, since JSON has no syntax to express either. Multi-document YAML (files with `---` separators) is handled by converting each document and wrapping the results in a JSON array, which is the one case where the output shape doesn't mirror the input shape one-to-one.
Worked example: YAML ↔ JSON Converter
A typical config fragment, `name: app\nports:\n - 80\n - 443\nenabled: true`, converts to: { "name": "app", "ports": [ 80, 443 ], "enabled": true } Going the other way, `{"a":{"b":[1,"x"]}}` becomes `a:\n b:\n - 1\n - x`. And a two-document file, `a: 1\n---\na: 2`, becomes a two-element JSON array (one object per document) rather than a single merged object, since each `---`-separated document is converted independently.
Two documents become a list, and one document does not
Direction opens on auto-detect. Leading space is ignored for that guess. If the text then starts with a curly brace or a square bracket, it is read as JSON and written as YAML. Anything else is read as YAML and written as JSON with a two-space indent. Two YAML documents separated by a line of three dashes become a JSON list. A single document is not wrapped in a list. Going back to YAML, there is no extra blank line at the end. Invalid YAML stops with the words Invalid YAML and only the first line of the reason. I can force a direction from the menu when a file starts with a brace but I still want it read as YAML.
Related tools
- Kubernetes YAML Validator & Linter
Validate Kubernetes manifests in your browser — YAML syntax, required fields, current apiVersions, selector/label mismatches, image tags, resource limits, probes and security settings.
- JSON Formatter & Validator
Format, beautify, validate and minify JSON — with clear line and column error messages and optional key sorting.
- XML ↔ JSON Converter
Convert XML to JSON and JSON back to XML, keeping attributes (as @name) and repeated elements (as arrays).
- CSV to JSON Converter
Convert CSV or spreadsheet data to a JSON array of objects, with header detection, number/boolean typing and any delimiter.
- JSON to CSV Converter
Turn a JSON array of objects into CSV for Excel or Google Sheets — nested objects are flattened into dot-notation columns.
- TOML / INI / ENV ↔ JSON Converter
Convert config files between TOML, INI, .env and JSON — validate a TOML file or turn a .env into JSON in one step.