YAML to JSON Converter
Convert YAML to JSON and back in your browser. One-click swap for a full round-trip, pretty or minified JSON, then copy or download. 100% private.
- Free, no account
- No watermark
- No usage limit
About the YAML to JSON Converter
Most YAML to JSON converters only go one way. You paste YAML, you get JSON, and the second you need the trip back you are off hunting for a different page and copy-pasting between two tabs. This one goes both directions in the same box. Convert YAML to JSON, hit Swap, and the JSON you just got drops straight into the input so you can push it back to YAML or keep editing, all on one screen without opening a second tab.
It all runs in your browser. Your YAML never touches a server, which matters when the file you are pasting has database passwords, API keys, or private infrastructure details in it. No account, no daily cap, and what this tool keeps in your browser is which direction and indent you last used, never the text itself. Paste your text, watch the result update as you type, then copy or download. And you pick the JSON shape yourself, from readable 2 or 4 space indentation to minified down to a single line for an API call.
How to use
- Pick the direction. YAML to JSON is the default. Click JSON to YAML if you are going the other way, or just drop a .json file and the tool flips for you.
- Paste your text into the left box, drag a .yaml, .yml, or .json file onto it, or click Open a file. Load sample shows a working example if you want to see the shape first.
- The result appears on the right as you type. There is no Convert button to hunt for.
- Choose the output format. For JSON that is 2 spaces, 4 spaces, tabs, or minified. For YAML it is 2 or 4 space indentation.
- Hit Swap to send the result back into the input and reverse the direction. Convert, swap, convert again, as many times as you need.
- Copy the result, or download it as a .json or .yaml file.
Why a two-way converter beats two one-way tools
Real work is rarely one direction. You write a config in YAML because it reads well, an API wants JSON, so you convert. Then the API hands something back, or a teammate drops a JSON blob on you, and now you want it as YAML to paste into a Helm values file. With a one-way tool that means a second tab open and your place lost mid-task. The Swap button keeps both formats on one screen. Convert once, flip, and the output becomes your next input with a single click. That turns a two-tab shuffle into a quick check you barely think about.
Pretty, minified, or somewhere between
The format control is not decoration, it decides what you can actually do with the result. Minified JSON strips every space and newline so the whole thing sits on one line, which is exactly what you want when you are pasting a request body into a curl command or a test fixture and do not want it wrapping across ten lines. Pretty JSON with 2-space indentation is the readable default most editors and linters expect. Four spaces suits teams whose style guide calls for it, and tabs are there for the editors that insist on them.
Going the other way, YAML indentation is 2 or 4 spaces, and that is the full list on purpose. YAML flat out forbids tabs for indentation, so quietly offering a tab option would only teach a habit that breaks the moment a real parser reads your file.
The type guessing that trips people up
YAML tries to be helpful and guesses types for unquoted values, and that is where conversions go sideways. Write version: 1.10 and YAML reads it as the number 1.1, dropping the trailing zero, so your JSON comes out as 1.1 and your version string is wrong. Write the Norway country code as a bare NO and older parsers turn it into the boolean false. That last one has a name, the Norway problem, and it has broken more than one deploy.
Those results are YAML following its own spec rather than the tool misbehaving. Converting to JSON is the fastest way to catch it, because JSON shows you the precise value the parser landed on, with no more guessing. If a number or a word came out wrong, wrap it in quotes in your YAML and convert again. The quotes tell the parser to leave it as plain text, and the JSON will show a proper string.
Where this actually gets used
Kubernetes is the big one. Manifests are YAML, but kubectl and most of the tooling around a cluster do their work in JSON, so converting a manifest lets you feed it to a script or diff it against what the cluster really has. Docker Compose files are YAML too, and converting one shows you exactly how Compose read your indentation. CI pipelines across GitHub Actions, GitLab, and CircleCI are all YAML and get deeply nested fast, so flattening a section to JSON makes the real shape obvious, including whether that on: [push] parsed the way you meant. Plenty of the time it is simpler than that. An app reads a YAML config, a test needs the same data as JSON, you convert once and paste.
Frequently asked questions
What happens to my YAML comments when I convert?
They get dropped, and swapping back will not bring them back. JSON has no syntax for comments at all, so every # line disappears the moment you convert to JSON. Because that information is already gone, converting the JSON back to YAML cannot recreate it. If a comment carries context you need, copy it somewhere safe before you convert. This is how every YAML to JSON converter behaves, not a limit of this one.
Why didn't the swap button give me my exact original YAML back?
Because a round-trip is lossy by nature. Comments vanish, the order of keys can shift, and YAML anchors and aliases (the &name and *name shortcuts that let you define a block once and reuse it) get expanded into full copies on the way to JSON. So swapping back gives you data that is equivalent, not character-for-character identical. The values match, the exact hand-formatting does not. Treat swap as a fast way to move between shapes, not a way to preserve a carefully formatted file.
Can I convert several YAML documents at once?
A single YAML stream can hold multiple documents separated by ---, which Kubernetes leans on to bundle a Deployment, Service, and ConfigMap in one file. JSON represents a single value, so a multi-document stream does not map onto one JSON output. Convert each document on its own by pasting one section at a time.
What does minified JSON actually save me?
Minified output removes every space and line break so the JSON is one unbroken line. That is what you want for a curl request body, a URL parameter, a database column, or anywhere the whitespace is pure noise. Pretty output with indentation is for reading and editing. It is the same data either way, and you flip between them without reconverting.
Are tabs allowed in the YAML output?
No, and that is deliberate. The YAML spec forbids tab characters for indentation, so the YAML side offers 2 or 4 spaces only. If you paste YAML that uses tabs to indent, the parser rejects it and the error points you at the line. Set your editor to insert spaces instead and the problem disappears.
Is there a size or usage limit?
No sign-up, no queue, no daily cap. Convert as much as you like, as often as you like. Because everything runs locally in your browser, the only real ceiling is your device's memory, and ordinary config files sit nowhere near it.
Does it work offline?
Yes. Once the page has loaded, the conversion runs entirely in the tab, so you can disconnect and keep working. Useful on a plane or a locked-down network where uploading a config was never an option anyway.
Can I share my exact setup with someone?
Yes. The Share button copies a link that carries your current direction and output format, so whoever opens it lands on the tool set up the same way. There is also an Embed option that drops the live converter onto your own site with a link back here.