DNS Checker.eu

YAML to JSON Converter

This YAML to JSON converter works both ways and live: edit either pane and the other updates, entirely in your browser - useful for Kubernetes manifests, CI pipelines and Docker Compose files.

Edit either side and the other updates. The YAML parser covers mappings, sequences, scalars and indentation - the shapes config files actually use - not anchors, aliases or multi-document streams.

About YAML to JSON Converter

Two panes, YAML on the left and JSON on the right, both editable. Change either and the other is regenerated as you type, so you can paste a manifest and read it as JSON, or paste an API response and get the YAML you need for a values file. Nothing is uploaded; the conversion runs in the page. That matters more than it sounds, because the files people convert are usually deployment manifests full of hostnames, image references, internal service names and occasionally a secret.

YAML 1.2 is formally a superset of JSON, which is why every JSON document is already valid YAML and why the two convert cleanly in principle. The friction in practice is scalar typing and indentation. YAML 1.1 parsers, which a great deal of tooling still follows, read no, yes, on and off as booleans, the reason the country code for Norway famously becomes false, and read 1.10 as a float, quietly turning a version string into 1.1. Tabs are not permitted for indentation at all. Converting to JSON, where every string is quoted and structure is explicit, makes those ambiguities visible.

The YAML parser here is a small purpose-built one rather than a large library shipped to every visitor. It handles mappings, sequences, scalars with implicit typing, whole-line comments and nesting by indentation, which is what real config files are made of. It does not implement anchors and aliases, merge keys, block scalars or multi-document streams, so a chart template leaning on those will not round-trip and needs a full YAML implementation instead. Parse errors from either side are reported as they happen, and both directions run entirely in your browser.

How to use it

  1. 1Paste your YAML into the left pane, replacing the sample.
  2. 2Read the generated JSON on the right, indented two spaces.
  3. 3Or paste JSON into the right pane to generate YAML on the left; either side drives the other.
  4. 4If the input cannot be parsed, read the error message below the panes and fix the offending line.
  5. 5Copy the converted output, keeping in mind that anchors, aliases, block scalars and multi-document files are outside the parser's scope.

Common use cases

  • -Converting a Kubernetes manifest to JSON to feed a tool or API that accepts only JSON.
  • -Turning a JSON API response into YAML for a Helm values file or a CI configuration.
  • -Checking how a YAML scalar is actually typed by seeing whether it lands in JSON as a string, a number or a boolean.
  • -Reviewing a deeply nested pipeline definition where explicit JSON braces are easier to follow than indentation.
  • -Auditing a Docker Compose file's structure without pasting it into a third-party service.

Frequently asked questions

Is YAML a superset of JSON?
Since YAML 1.2, yes: any valid JSON document is also valid YAML, so a parser implementing 1.2 reads JSON directly. The reverse does not hold, because YAML adds comments, anchors, multiple documents, block scalars and unquoted scalars with implicit typing that have no JSON equivalent. Converting YAML to JSON therefore drops comments and resolves every ambiguous scalar to one concrete type.
Why does YAML turn no into false?
Because YAML 1.1 treats y, yes, no, on and off as booleans, and much tooling still follows 1.1 or a hybrid of it. The best-known casualty is the country code NO for Norway, read as false unless quoted. YAML 1.2 narrowed the boolean set to true and false, but the safe habit stands: quote anything that could be mistaken for a boolean, a number or a date.
How do I convert a Kubernetes YAML manifest to JSON?
Paste the manifest into the YAML pane and read the JSON beside it. kubectl accepts either form, but some admission controllers, policy engines and APIs want JSON. This converter handles the mappings, sequences and scalars a manifest is built from, and does it in your browser so the manifest is never uploaded. Templates relying on anchors or multiple documents need a full YAML library.
Can this converter handle YAML anchors and multiple documents?
No, and it says so rather than producing something subtly wrong. The parser covers mappings, sequences, scalars, comments and indentation, the shapes ordinary config files use, but not anchors and aliases, merge keys, block scalars or multi-document streams. For those, use a full YAML 1.2 implementation such as the library in your language's standard tooling.