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.

Usage tips

  • 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.

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.
ツールくん

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.

→ Browse all trivia