YAML to JSON
Convert YAML config into JSON, with anchors and multi-line strings resolved.
About this tool
YAML is what configuration looks like across most infrastructure work: Kubernetes manifests,
GitHub Actions workflows, docker-compose files, Ansible playbooks, OpenAPI specs. The moment you
need to do something programmatic with one of those files, JSON is the easier shape to work with —
jq can query it, a JSON Schema validator can check it, a test fixture can embed it,
and every language parses it without pulling in another dependency. Converting also settles
arguments about what the YAML actually says. Paste a deployment manifest and you can see straight
away whether replicas came through as the number 3 or the string "3", whether a bare
no stayed a string instead of flipping to false, and where an empty
value quietly became null. Parsing goes through js-yaml on the YAML 1.2 core
schema, so anchors and aliases are expanded, a merge key written as << is
folded into the map that pulls it in, block scalars written with | or
> keep or fold their line breaks the way the spec describes, and integers,
floats, booleans and nulls land in JSON as real types instead of quoted text. Dates come out
as strings, because JSON has no date type of its own.
Everything runs in the page. The YAML never leaves your machine, there is no upload step and no server to trust, which is the whole difference between pasting a throwaway docker-compose file and pasting a manifest that names an image registry, an internal service, or a secret reference. Because the parse happens locally, the result appears as fast as you can press Convert: no round trip, no queue, and no cap on how many files you push through in a sitting. One thing worth remembering before you paste — YAML is indentation-sensitive, and tab characters are illegal as indentation. If a file that looks perfectly aligned in your editor gets rejected, a stray tab is the first thing to check; switching the editor to insert spaces usually makes the error go away. Indent the JSON with two spaces, four, or a tab, and the output is plain text you can copy straight into a fixture, a request body, or a validator.
Frequently asked questions
Does my YAML get uploaded anywhere?
No. The YAML is parsed by js-yaml running inside your browser tab, and the page never sends your content over the network. Load the page, go offline, and it keeps converting. That matters when the file is a secret template or a CI workflow that still has deploy tokens and internal hostnames in it.
Why does it complain about tabs or indentation?
YAML forbids tab characters for indentation; only spaces are legal there. An editor that inserts a real tab produces a file that looks aligned on screen but will not parse. The other frequent cause is sibling keys sitting at different depths. Replace every tab with spaces and keep each nesting level at a fixed width.
Are anchors and aliases expanded?
Yes. An anchor defined with &defaults and referenced with *defaults is resolved while parsing, so the JSON output carries the fully expanded value at every point the alias appeared. A merge key that pulls an anchored map into another map behaves the same way. JSON has no notion of references, so expansion is the only faithful translation.
Can it convert a file with several documents separated by ---?
Not in one pass. A file holding multiple documents is a stream, and this converter reads a single document, so it reports an error rather than guessing which one you meant. Split the file at the separators and convert each document on its own, which is also the shape most JSON consumers expect to receive.