YAML to JSON Converter
Convert YAML to JSON and JSON to YAML as you type, with exact error locations.
1 line · 0 characters
This converter turns YAML into JSON and JSON into YAML as you type. It is built for the files developers actually juggle - Kubernetes manifests, docker-compose files, GitHub Actions workflows, OpenAPI specs and app configs - and shows the exact line of any syntax error. Everything runs in your browser, so configs with secrets in them never leave your device.
How to convert YAML to JSON
- Paste YAML into the input box, or upload a .yaml or .yml file.
- The JSON appears straight away. If the YAML has a mistake, the line and column are shown so you can fix it.
- Copy the JSON, or download it as a .json file.
Anchors and aliases (&defaults and *defaults) and merge keys (<<: *defaults) are expanded, so the JSON contains the full, resolved values. A file with several documents separated by ---, common in Kubernetes, becomes a JSON array with one item per document.
How to convert JSON to YAML
Switch to JSON → YAML and paste JSON. Keys keep their order unless you choose to sort them, multi-line strings become readable | blocks, and any value YAML could misread - such as the text "true", "no" or "0123" - is quoted so it stays text.
YAML 1.2 and the "Norway problem"
Older YAML 1.1 parsers read yes, no, on and off as true or false - so the country code NO for Norway turned into false. This tool follows YAML 1.2, the current standard used by Kubernetes and most modern tools, where only true and false are booleans. Dates such as 2024-01-15 also stay exactly as written rather than being converted to timestamps.
What doesn't carry over
- Comments - JSON has no comment syntax, so YAML comments are dropped (the tool tells you when that happens).
- Very large whole numbers - anything beyond about 16 digits can't be stored exactly in JSON. Quote such IDs to keep them as text.
- .inf and .nan - these YAML numbers have no JSON equivalent and become
null.
Frequently asked questions
Is my YAML or JSON uploaded anywhere?
No - conversion happens in your browser and nothing is sent or stored, which makes it safe for configs containing passwords or API keys.
Why does my YAML give a "bad indentation" error?
YAML uses indentation to show structure, and tabs aren't allowed for it. Check that items at the same level line up exactly and use spaces only. Pressing Tab in the input box here inserts two spaces for you.
Is JSON valid YAML?
Almost always - YAML 1.2 was designed as a superset of JSON, so most JSON files can be read by a YAML parser as they are. Converting still helps when you want the cleaner, indented YAML style.
Related tools
Format and repair JSON with the JSON Formatter, Validator & Fixer, convert spreadsheets with the CSV to JSON Converter, or browse all Developer tools.
Runs entirely in your browser - nothing you enter or upload is sent to a server.
Need it to do something else? Request a tool