Mini Tools

YAML to JSON Converter (and Back)

Convert YAML to JSON and back as you type. Full YAML 1.2 support: anchors & aliases, merge keys, multi-line strings and multiple documents. All client-side.

YAML

JSON

Errors


    

YAML vs JSON

YAML and JSON describe the same kinds of data — maps, lists, strings, numbers, booleans and null. JSON is strict and ideal for APIs; YAML is indentation-based, supports comments and is popular for configuration (Kubernetes, Docker Compose, GitHub Actions, Ansible, OpenAPI).

YAMLJSON
name: api
replicas: 2
ports:
  - 80
  - 443
debug: false
{
  "name": "api",
  "replicas": 2,
  "ports": [80, 443],
  "debug": false
}

How to use this converter

  • Paste YAML on the left and click YAML → JSON, or paste JSON on the right and click JSON → YAML.
  • Errors are shown below the editors.
  • Validate or prettify the JSON result with the JSON Formatter.

YAML gotchas

  • Indent with spaces, never tabs. Indentation defines structure.
  • Quote ambiguous strings. Values like yes, no, on, off may become booleans in YAML 1.1 parsers (the “Norway problem” with NO).
  • Quote strings containing : or starting with #, @, *, &.
  • Leading zeros such as 0755 can be read as octal numbers — quote them to keep strings.

The converter uses the js-yaml parser and supports the full YAML 1.2 spec: anchors and aliases (&defaults / *defaults), merge keys (<<), block scalars (| and >) and multiple documents separated by --- (converted to a JSON array).

Frequently asked questions

Is YAML a superset of JSON?

YAML 1.2 is designed so that valid JSON is also valid YAML, which is why you can paste JSON into most YAML files.

Are comments preserved when converting?

No. JSON has no comments, so YAML comments are dropped when converting to JSON.

Does it support anchors, aliases and multiple documents?

Yes. Anchors, aliases and merge keys are resolved into plain JSON, and a file with several documents separated by --- becomes a JSON array.

Why did my value turn into true or false?

Unquoted words like yes/no/on/off can be interpreted as booleans. Wrap them in quotes to keep them as strings.

Is my data uploaded?

No. Conversion runs entirely in your browser.