YAML to JSON Converter
Convert a common subset of YAML to formatted JSON entirely in your browser. This tool handles nested maps, sequences, and scalar values, but it is a lightweight parser, not a full YAML engine.
How to use this tool
- 1
Paste or type your YAML into the input box, using spaces (not tabs) for indentation.
- 2
Read the pretty-printed JSON that appears below the box as you type.
- 3
If a red error message shows instead, check your indentation and remove unsupported syntax.
- 4
Select and copy the JSON output to paste into your config, code, or API client.
How does this YAML to JSON converter actually work?
YAML and JSON are both data-serialization formats that describe the same kinds of structures: maps (key/value pairs), sequences (lists), and scalars (strings, numbers, booleans, null). JSON uses explicit braces, brackets, and quotes, while YAML relies on indentation and is friendlier to read and edit by hand. This converter walks your YAML line by line and tracks indentation with a stack to rebuild the nesting, then serializes the result with JSON.stringify and two-space indentation. Scalars are coerced by simple rules: 'true' and 'false' become booleans, 'null' and '~' become null, anything matching a plain integer or decimal becomes a number, and everything else stays a string with one layer of surrounding single or double quotes stripped. Because it is a deliberately small parser, it does NOT implement the full YAML 1.1/1.2 specification. There is no support for anchors and aliases, block or folded multi-line scalars (| and >), flow-style inline collections ({} and []), multiple documents, tags, or inline comments after a value. Only full-line comments starting with # are removed, and indentation must use spaces because tabs are not interpreted. For those edge cases, reach for a complete library such as js-yaml or PyYAML.
Common use cases
Quickly turning a small docker-compose.yml or GitHub Actions snippet into JSON to inspect its structure.
Converting a hand-written config block into JSON to paste into a tool or API that only accepts JSON.
Checking how YAML scalars like true, 123, or ~ get typed once they become JSON values.
Sanity-checking indentation in a YAML fragment by seeing whether the nesting comes out as you expect.
Generating seed JSON fixtures for tests from a more readable YAML draft.
Teaching or learning the mapping between YAML structures and their JSON equivalents.
Frequently asked questions
Which YAML features are supported?▼
Which YAML features are NOT supported?▼
Why do I need to use spaces for indentation?▼
What happens with an inline comment like 'key: value # note'?▼
Is my data uploaded anywhere?▼
Why did I get an error or unexpected output?▼
Related tools
JWT Decoder
Decode JSON Web Tokens (JWT) instantly — inspect the header, payload, and signature claims. Runs entirely in your browser; tokens never leave your device. Safe for production secrets.
JSON Formatter & Validator
Format, validate, and minify JSON instantly. Catches syntax errors with line numbers, pretty-prints with adjustable indent, supports large payloads. Runs in your browser — no upload.
XML Formatter & Beautifier
Format and beautify XML documents — proper indentation, line breaks, namespace handling. Useful for SOAP responses, sitemaps, RSS feeds, and Android resource files.
Base64 Encoder & Decoder
Encode and decode Base64 strings.
URL Encoder & Decoder
Encode/decode URL-safe strings.
HTML Entity Encoder & Decoder
Convert special characters to/from HTML entities.