YAML to JSON Converter
Paste YAML, get clean JSON — or the other way around — with nested objects and lists handled correctly, not just flat key-value pairs.
About this tool
What this YAML/JSON converter does
Kubernetes manifests, GitHub Actions workflows, Docker Compose files, and half of every modern app's config live in YAML, but plenty of tools and APIs only speak JSON. This converter goes both directions from one page: paste YAML and get JSON, or paste JSON and get YAML, with the direction switchable with one click and both textareas swapping their contents instantly.
It's a real parser, not a regex hack — nested mappings, nested lists, lists of objects, comments (#), single- and double-quoted strings, and inline flow collections like [80, 443] or {a: 1, b: 2} are all handled correctly, matching how config files actually look in the wild rather than only supporting flat key-value pairs.
How to use it
Pick a direction, paste your content into the left box, and the converted result appears on the right as you type — no button to press. Use "Swap Direction" to flip both the mode and the two textareas' contents at once (handy for a quick round-trip sanity check), and choose 2-space, 4-space, or minified JSON output when converting YAML to JSON. Hit "Load Sample" any time to see a worked example with nested objects, a list, and an inline array.
A real example
A typical Kubernetes-style snippet like:
replicas: 3 selector: app: web ports: - 80 - 443
converts cleanly to {"replicas": 3, "selector": {"app": "web"}, "ports": [80, 443]} — nested object and list both preserved, not flattened.
Frequently asked questions
Does this support YAML anchors and aliases (& and *)?
No — anchors/aliases, multi-document files (separated by ---), and block scalars (| and > for multi-line strings) aren't supported. Those cover a small minority of real-world config files; standard nested maps, lists, and scalars — the vast majority of YAML you'll actually run into — work correctly.
Why did my string get wrapped in quotes after converting to YAML?
The converter quotes any string that could otherwise be misread as a number, boolean, null, or YAML syntax (like a value starting with - or containing : ) — it's being conservative to guarantee the output re-parses correctly, even if that means a few extra quote marks you wouldn't strictly need by hand.
Is this the same as a YAML linter or validator?
Not quite — it doesn't check your YAML against a schema, it converts it. If your YAML has a real syntax problem, conversion will fail and show an error, but it won't tell you about issues like duplicate keys the way a dedicated linter would.
Can I convert a JSON array at the top level, not just an object?
Yes — both directions handle top-level arrays as well as top-level objects.
Is my data uploaded anywhere?
No. Parsing and conversion both happen entirely in your browser; nothing you paste is sent to a server.
