Converters YAML ⇄ JSON Converter

YAML ⇄ JSON Converter

Convert YAML configuration files to JSON, or JSON objects into clean, indented YAML. Handles files up to 200MB.

Or convert a file directly — supports files up to 200MB

Drag & drop a file here, or click to browse

Processed in the background, so the page stays responsive even for huge files

How to use this tool

Choose YAML → JSON or JSON → YAML, then paste or upload; the other pane follows as you type. YAML → JSON is handy for inspecting Kubernetes manifests, CI configs, or Docker Compose files as plain JSON; JSON → YAML is useful for turning API responses into readable config files. Syntax errors are reported with a clear message.

Worked example: what YAML → JSON changes

A small service config:

# owner: payments team
service: billing-api
enabled: yes
debug: on
active: true
version: 1.10
port: 08080
zip: "073301"

converts to:

{
  "service": "billing-api",
  "enabled": "yes",
  "debug": "on",
  "active": true,
  "version": 1.1,
  "port": 8080,
  "zip": "073301"
}
  • The comment is gone. JSON has no comment syntax, so the owner note can't come along.
  • yes and on stay strings. The parser follows YAML 1.2, where only true and false are booleans. A tool that reads YAML 1.1 treats yes, no, on and off as booleans too, so the same file can mean different things to two programs. Write true or false when you mean a switch.
  • Unquoted numbers lose their formatting: 1.10 becomes 1.1 and 08080 becomes 8080. The quoted "073301" stays a string with its leading zero, so quote anything that is a label rather than a quantity.

JSON → YAML: the quotes that keep values safe

Going the other way, the converter quotes any string that another YAML reader could take as something else. This JSON:

{"switch": "on", "answer": "yes", "enabled": true, "version": "1.10", "zip": "073301"}
switch: 'on'
answer: 'yes'
enabled: true
version: '1.10'
zip: '073301'

The strings "on" and "yes" are quoted so a YAML 1.1 tool doesn't turn them into true, and "1.10" and "073301" are quoted so they don't become numbers. The real boolean true stays unquoted.

Frequently Asked Questions

Why do so many config file formats (Kubernetes, Docker Compose, CI pipelines) use YAML instead of JSON?

YAML was designed to be easy for humans to write and read by hand — no braces, no required quotes around most strings, and indentation instead of punctuation to show nesting. JSON is easier for machines to parse unambiguously and is the standard for APIs, but its brackets and quotes make longer hand-written config files more tedious to write and review than the equivalent YAML.

Does converting JSON to YAML preserve data types correctly?

Yes — numbers stay unquoted numbers, booleans stay true/false, and strings that could be misread as another type (like the ZIP code "73301", which looks numeric) are quoted to preserve their intended type. This matters because an unquoted numeric-looking string can silently become an actual number when a YAML file is later parsed by something else.

Why does my YAML → JSON conversion fail with an indentation error?

YAML uses indentation to represent nesting, so unlike JSON's braces, a single misplaced space changes what a line belongs to. A tab used for indentation is always an error, because YAML allows only spaces there; a list item indented too deep can be valid YAML that means something else, with no error at all: "- banana" pushed two spaces right under "- apple" turns the list into the single string "apple - banana". When there is an error, it ends with (line:column), such as (2:1) for a tab at the start of line 2.

Related Tools

Related Blog Posts