YAML to JSON Converter

Convert YAML data to JSON. Instantly turn structures written in YAML — Kubernetes manifests, docker-compose.yml, CI config files — into a format that JSON-only tools like jq can work with, right in your browser.

What is YAML to JSON conversion?

YAML to JSON conversion takes configuration written in the human-friendly YAML format — Kubernetes manifests, docker-compose.yml files, GitHub Actions workflow definitions — and turns it into JSON that programs can process mechanically, right in your browser. This tool understands mappings (`key: value`), block sequences (`- item`), flow sequences (`[a, b, c]`), flow mappings (`{a: 1, b: 2}`), basic scalars such as strings, integers, decimals, booleans, and null, plus `#` comments. If your YAML sticks to the constructs that show up in everyday configuration files, you can paste it in and get a working JSON representation immediately.

That said, this converter does not implement the entire YAML 1.2 specification. It intentionally leaves out anchors (`&`) and aliases (`*`) used for reusing values, multi-document streams (a second or later `---` marker triggers an error), block scalars (`|` and `>`) for multi-line strings, and same-line nested sequences like `- - item`. If your input relies on any of these advanced features, the conversion will fail with an error, so it helps to rewrite that part into a simpler equivalent form before pasting it in. Everything runs locally in your browser — nothing you paste is ever sent to an external server, which matters when the YAML you are inspecting contains credentials or internal infrastructure details.

How to use the YAML to JSON converter

  1. Paste your YAML Paste the YAML you want to convert into the input box on the left. If you do not have a file handy, click "Load sample" to try a working example first.
  2. Check the converted JSON The JSON output appears on the right as soon as you type or paste. If the input has a syntax problem, an error message explaining the likely cause is shown in its place.
  3. Toggle pretty-print on or off Turn "Pretty-print" on for an indented, easy-to-read layout, or turn it off to collapse everything into a single line with no line breaks — whichever suits where you are pasting the result.
  4. Copy or download the result Use the copy button to send the JSON straight to your clipboard, or the download button to save it as a standalone .json file for later use.

Tips for getting more out of it

  • Paste a Kubernetes manifest or docker-compose.yml directly to visualize its structure as JSON, so command-line tools like jq that only understand JSON can query it.
  • Unquoted values like postal codes or phone numbers that start with a leading zero get parsed as numbers, dropping the leading zero — always quote values you want kept as strings.
  • Complex YAML using anchors (`&`), aliases (`*`), or block scalars (`|`/`>`) is not supported. Rewrite it in a simpler form before pasting it in.
  • Uncheck "Pretty-print" to get a single-line JSON output with no line breaks — handy when pasting into an API request body where newlines aren't wanted.

Where YAML to JSON conversion helps

Querying a Kubernetes manifest with jq

Manifests can easily run to several hundred lines. Convert one to JSON and pipe it into jq, and a path like `.spec.containers[].image` pulls out exactly the value you need in an instant.

Feeding docker-compose.yml into a script

If a script or automation you are writing does not already bundle a YAML parser, converting the compose file to JSON first lets you read it with nothing more than a built-in JSON parser.

Visualizing the structure of a CI configuration

Paste a GitHub Actions or GitLab CI workflow file to see its structure rendered as JSON — nested relationships that are easy to lose track of in an indentation-only view become explicit key paths.

Preparing to work with a YAML-only tool or API

Even if your source of truth is JSON, converting an existing YAML file first can help you confirm exactly how its structure is organized before you write code against it.

Chaining into other JSON tools

Paste the converted JSON straight into JSON to TypeScript type definitions or the JSON formatter to keep working with it.

YAML glossary

YAML
A recursive acronym for "YAML Ain't Markup Language." YAML represents nested structure through indentation rather than brackets, and allows comments and mostly-optional quoting, which is why it is the format of choice for configuration files that people edit by hand.
Mapping
A YAML structure that pairs keys with values using `key: value` syntax. It corresponds to a JSON object, and lines sharing the same indentation level are treated as keys belonging to the same level of the structure.
Block sequence
A YAML array written as a series of lines that each start with a hyphen and a space, such as `- item`. It corresponds to a JSON array; this tool reads a run of `-` lines at the same indentation level as a single array.
Flow style
A way of writing a sequence or mapping on a single line without using the indentation-based block style, such as `[a, b, c]` or `{a: 1, b: 2}`. It looks much closer to how JSON arrays and objects are written.
Anchors and aliases
A YAML feature where `&name` labels a value so it can be referenced elsewhere with `*name`, letting the same block of configuration be reused without repeating it. This tool does not support this feature.
Block scalar
A way of writing a multi-line string starting with `|` (which preserves line breaks) or `>` (which folds line breaks into spaces). It is common for embedding shell scripts or long descriptions, but this tool does not support it.
Document stream
A mechanism for packing multiple YAML documents into a single file, separated by `---` markers. Kubernetes configurations often bundle several resources this way, but this tool only converts a single document at a time.

Frequently asked questions

It helps when you want to query or process a Kubernetes manifest or CI config with a JSON-only command-line tool like jq, or when an API or script only accepts JSON and can't take YAML input directly.

No. This tool is a lightweight parser limited to commonly used constructs (mappings, sequences, basic scalars), so value-reuse features like anchors and aliases, multi-document streams, and block scalars (`|`/`>`) are out of scope.

The most common cause is inconsistent indentation — items at the same level with a mismatched number of spaces, or indentation done with tabs instead of spaces. A missing space after the colon in `key: value` will also cause a parse failure.

This tool only supports the YAML-to-JSON direction. If you need to format or validate JSON or YAML on their own, check the other formatter tools on this site.
Tool-kun

Side Note — Why config files are written in YAML but tools want JSON

YAML is widely used for configuration files that humans edit directly — Kubernetes, docker-compose, GitHub Actions workflows, Ansible playbooks — thanks to its readability: comments are allowed and quoting is mostly optional. JSON, by contrast, has a small and unambiguous specification that's easy for programs to process mechanically, which is why it has become the standard input format for API data exchange and command-line tools like jq.

YAML-to-JSON conversion bridges this gap between "humans write YAML, tools want JSON." Kubernetes manifests in particular can run hundreds of lines, and `grep` alone quickly hits its limits when hunting for a specific value. Convert to JSON first, then query it with jq, and you can pull out exactly the value you need with a path like `.spec.containers[].image`.

That said, the full YAML specification (YAML 1.2) is vast, covering advanced features like value reuse via anchors and aliases, multi-document streams, and block scalars for multi-line strings. This tool deliberately skips that entire surface and focuses on the "common subset" of mappings, sequences, and basic scalars that shows up in practice — keeping the implementation simple with zero external dependencies.