Skip to content
BENIBIX Learn

JSON vs YAML

YAML uses indents and allows comments, so it suits settings files. JSON uses brackets and is the usual choice for APIs.

Development📄 Files & Formats

JavaScript Object Notation (JSON)

A plain text format for data, made of names and values. Most APIs use it.

JSON is a plain text way to write down data so programs can swap it. It uses names and values in curly brackets, like "age": 36. It can hold text, numbers, true or false, null, lists and nested groups. Almost every language can read and write it. Most web APIs send and receive their data as JSON.

Example
Jack's app asks a weather API for London. The reply is JSON with the temperature, the wind and the chance of rain.
Why it matters
JSON is the common language of the web. If two programs talk, it is very likely in JSON.
Full entry
Development📄 Files & Formats

YAML Ain't Markup Language (YAML)

A text format that is easy to read. It uses indents and is common for settings.

YAML is a text format built to be easy for people to read and write. It uses indents instead of brackets, and a dash starts each list item. It is the usual format for config files in tools like Docker Compose, Kubernetes and GitHub Actions. It also allows comments, which JSON does not. The spaces matter, so a wrong indent changes the meaning.

Example
Jack writes a YAML file that tells his test server to run three steps. Each step is one line starting with a dash.
Why it matters
Most modern build and deploy tools are set up in YAML. Reading it is a daily skill.
Full entry

In one line

JavaScript Object Notation (JSON)
A plain text format for data, made of names and values. Most APIs use it.
YAML Ain't Markup Language (YAML)
A text format that is easy to read. It uses indents and is common for settings.