Text Utils
By ToolzBank Team•
2 min read
•Monday, October 19, 2026•Updated Monday, October 19, 2026

YAML vs JSON: Differences and How to Convert Between Them

YAML and JSON describe the same data in different styles. Learn the differences, the common YAML mistakes, and how to convert between the two instantly.

#yaml to json#json to yaml#yaml#yaml converter

Kubernetes manifests, docker-compose files, GitHub Actions workflows and many app configs are written in YAML. APIs and JavaScript code use JSON. Both describe the same kinds of data — objects, lists, strings, numbers, booleans and null — so converting between them is common when a tool expects one and you have the other.

The same data in both formats

# YAML
service:
  name: web
  ports:
    - 80
    - 443
  debug: false
{ "service": { "name": "web", "ports": [80, 443], "debug": false } }

YAML uses indentation and dashes instead of braces and brackets, does not require quotes around most strings, and allows comments with #. JSON is stricter, has no comments and is easier for programs to parse.

Common YAML mistakes

  • Tabs instead of spaces — YAML indentation must use spaces.
  • Inconsistent indentation — items at the same level must line up exactly.
  • Missing space after a colon — name:web is a string, not a key-value pair; write name: web.
  • Unquoted special values — in older YAML parsers, words like yes, no and on may turn into booleans; quote them if you mean text.

How to convert YAML to JSON (and back)

  1. Open the YAML to JSON Converter.
  2. Choose YAML → JSON or JSON → YAML, or open a .yaml, .yml or .json file.
  3. Paste your data. The output appears as you type — or an error with the exact line and column.
  4. Copy the result or save it as a file.

YAML files with several documents separated by --- become a JSON array. Comments are dropped, because JSON cannot store them. To tidy the resulting JSON, use the JSON Formatter.

Frequently Asked Questions

Is YAML a superset of JSON?

Mostly. YAML 1.2 accepts valid JSON, so JSON can usually be read as YAML, but not every YAML file can be written as JSON without losing comments.

Are YAML comments kept when converting?

No. JSON has no comment syntax, so comments are removed when converting YAML to JSON.

Why does my YAML show an error?

Usually because of tabs, inconsistent indentation or a missing space after a colon. The converter shows the line and column of the problem.

Is my data uploaded?

No. Conversion runs in your browser.