JSON ↔ YAML Converter
Convert bidirectionally between JSON and YAML in real time.
About this tool
YAML is the configuration language of modern infrastructure: Kubernetes manifests, Docker Compose files, GitHub Actions and GitLab CI pipelines, Ansible playbooks and OpenAPI specs are all written in it. JSON is what programs and APIs speak. You constantly need to move between the two, for example to feed a config to a script, or to turn an API response into a readable manifest.
This converter translates YAML to JSON and JSON to YAML, and also re-formats YAML with consistent indentation. It understands multi-document files separated by ---, expands anchors and aliases, and points to the exact line and column when indentation is wrong. Everything runs locally, so secrets inside configuration files stay on your machine.
How to use JSON ↔ YAML Converter
- Choose YAML → JSON, JSON → YAML or Format YAML, then paste text or open a .yaml, .yml or .json file.
- Pick 2- or 4-space indentation and, if you like, sort keys alphabetically to make two configs easy to compare.
- For files with several documents (common in Kubernetes), keep "Multiple documents → array" on to get a JSON array with one element per document.
- If the input is invalid, the error shows the line and column with a pointer under the problem.
- Copy or download the result. Use Swap to convert the output back the other way.
Examples
YAML to JSON
server: port: 8080 tls: true hosts: - a.example.com - b.example.com
{
"server": { "port": 8080, "tls": true },
"hosts": ["a.example.com", "b.example.com"]
} Anchors and aliases are expanded
defaults: &d retries: 3 job: <<: *d name: build
{ "defaults": { "retries": 3 }, "job": { "retries": 3, "name": "build" } } YAML pitfalls worth knowing
- Indentation is structure. Use spaces, never tabs, and keep sibling keys aligned; most YAML errors are one space off.
- Strings that look like other types need quotes. Version "1.10" becomes the number 1.1 without quotes, and a value like 0755 or 2026-01-01 may not be what you expect in older parsers.
- The "Norway problem": YAML 1.1 parsers read NO, yes, on and off as booleans. This tool follows YAML 1.2, where only true and false are booleans, but quote such values anyway if other tools will read the file.
- A colon followed by a space starts a mapping, so values like "time: 10:30" or URLs with ": " need quotes.
- Comments (# …) are not part of the data, so they disappear when YAML is converted to JSON or re-generated.
JSON is valid YAML
YAML 1.2 is a superset of JSON, so any JSON document is already valid YAML. Converting JSON to YAML is about readability: block style removes braces, brackets and most quotes, and allows comments to be added afterwards. Converting YAML to JSON is about interoperability: every language has a JSON parser, and JSON has no indentation ambiguity.
Frequently asked questions
Everything you need to know about this tool and data security.
Why did my comments disappear?
Comments are not part of the data model, so no YAML parser keeps them when converting. Keep the original file if you need the comments, and use this tool to validate or to produce JSON.
How do I convert a multi-document Kubernetes file?
Paste the whole file including the --- separators. With "Multiple documents → array" on, you get a JSON array; Format YAML keeps the documents separated by ---.
Is the output safe to use with kubectl or docker compose?
Yes. The output is standard YAML 1.2 / JSON. Keys and values are preserved exactly; only formatting, quoting style and key order (if you choose to sort) change.
Why does a value come out quoted?
The generator quotes strings that would otherwise be read as another type, such as "007", "true" or "1.10", so the meaning stays exactly the same when the file is read back.
Is my data safe when using this tool?
Yes, 100% safe. This tool operates entirely inside your web browser using client-side JavaScript and WebAssembly. Your data never touches any external server.
Related Tools
Prettify, validate, and minify JSON data instantly in your browser.
Convert tabular CSV data to structured JSON and JSON arrays to CSV.
Encode text to Base64 or decode Base64 to UTF-8 text with instant live conversion.
Featured Projects tech-fun.net
Explore more AI & productivity tools
Nihongo GameBox
Master Japanese typing, Kana, and JLPT N5–N1 vocabulary through interactive retro arcade games.
ResumeGPT
Tailors CVs and cover letters to every job opportunity with a multi-agent LLM pipeline, job tracking, and scheduled discovery.
CollectMind
Turns your bookmarks into a searchable AI knowledge base — entirely on-device, powered by Chrome's built-in Gemini Nano.