🔁 YAML ↔ JSON Converter
Convert between YAML and JSON instantly. Multi-document, sort keys, custom indent — all in your browser.
JSON output will appear here
About this YAML ↔ JSON Converter
YAML (YAML Ain't Markup Language) and JSON are the two most common formats for configuration files, API responses, and infrastructure definitions. Kubernetes manifests, GitHub Actions workflows, Helm charts, Spring Boot application.yml, and Ansible playbooks all use YAML. REST APIs, microservices, and most databases use JSON. This tool lets you flip between the two instantly — no server, no sign-in, no data ever leaving your browser.
The converter handles real-world edge cases: multi-document YAML (files with multiple ---separators), nested structures of any depth, arrays, booleans, nulls, and numbers. JSON output uses correct typing — true/false not strings, numbers not quoted, andnull not "null".
How to use
- Choose direction — YAML input → JSON output, or JSON input → YAML output — using the toggle bar at the top.
- Paste or type your input into the left pane. Conversion happens live within 500ms.
- Adjust options in the output pane header: indent (2 spaces, 4 spaces, Tab) and Sort Keys.
- Swap direction — clicking the other mode automatically moves the current output back as input.
- Copy or Download the result using the buttons in the header or the stats strip below the panes.
Features
⚡ Live conversion
Converts as you type with a 500ms debounce. No button press required.
📄 Multi-document YAML
Handles YAML files with multiple --- separators (common in Kubernetes). Each document is converted and combined into a JSON array.
🔤 Sort Keys
Alphabetically sort all object keys at every nesting depth. Useful for diffing configs or producing canonical output.
🎨 Syntax highlighting
Colour-coded output for both JSON and YAML — keys, strings, numbers, booleans, nulls, comments, and anchors.
↕ Bidirectional swap
Switch direction and the converter automatically re-feeds the current output as the new input — no copy-paste needed.
⬇ Download as file
Save the converted output directly as a .json or .yaml file with one click.
🔒 100% private
All conversion runs locally in your browser using js-yaml. No data is sent to any server.
📐 Custom indent
Choose 2 spaces, 4 spaces, or Tab for the output. The setting persists while you edit.
YAML vs JSON — quick reference
📋 YAML strengths
Human-readable, supports comments, less verbose for nested structures, native multi-document support. Preferred for config files (K8s, GitHub Actions, Spring Boot, Ansible).
📋 JSON strengths
Universal support in every language and framework, strict syntax prevents ambiguity, faster to parse, native to JavaScript and REST APIs. Required by most API clients and databases.
Frequently Asked Questions
Why does YAML boolean 'yes' / 'no' become true / false in JSON?
YAML 1.1 (the widely-deployed version) treats yes, no, on, off, true, false — in any capitalisation — as boolean values. This converter follows that spec, so 'yes' becomes true in JSON. If you need the string 'yes', quote it in YAML: '"yes"'.
What is a multi-document YAML file?
A YAML file can contain multiple independent documents separated by --- (three dashes). This is common in Kubernetes, where a single file might define a Deployment and a Service. This converter detects multiple documents and wraps them in a JSON array.
My YAML has anchors (&) and aliases (*) — will they convert correctly?
Yes. js-yaml resolves anchors and aliases before converting, so the output JSON will contain the fully expanded values. The anchor/alias shorthand itself is not preserved since JSON has no equivalent concept.
Can I convert a Kubernetes YAML manifest to JSON?
Yes. Paste the manifest (single or multi-document) and the converter produces valid JSON. Note that kubectl also accepts JSON natively — you can apply JSON manifests with kubectl apply -f.
Why does JSON → YAML sometimes add extra quotes around strings?
The YAML serialiser quotes strings that would otherwise be interpreted as a different type — for example, a string '"true"' must be quoted to distinguish it from the boolean true. This is correct YAML and round-trips cleanly back to JSON.
Does this support YAML 1.2?
The converter uses js-yaml which implements YAML 1.2 parsing rules by default. The main difference from 1.1 is that 'yes'/'no'/'on'/'off' are no longer booleans in strict 1.2 mode. If your YAML was written for a 1.1 parser (most tools), this could cause differences.