YAML and JSON Basics: The Language of DevOps Configs

👋 Welcome Back, DevOps Explorer!
Today we’re diving into two formats you’ll encounter everywhere in DevOps:
YAML (YAML Ain’t Markup Language)
JSON (JavaScript Object Notation)
These are data serialization languages. That’s a fancy way of saying: they store data in a structured way so computers (and humans) can understand it.
They’re especially used in:
Kubernetes configuration files 🐳
GitHub Actions workflows 🤖
Docker Compose files 🐋
Terraform variables and plans 🌍
CI/CD pipelines 🔄
Application settings and secrets 🗝️
Let’s break both down step by step 👇
🧵 What Is YAML?
YAML is a human-readable data format that uses indentation instead of brackets.
It’s the go-to language for configuration in tools like Kubernetes, Ansible, GitHub Actions, and Docker Compose.
🟨 YAML Example: Kubernetes Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-container
image: nginx:latest
ports:
- containerPort: 80
🧠 What You Should Notice:
Indentation matters (just like Python!)
No curly braces, no semicolons
Hyphens
-
define listsColons
:
separate keys and values
🔷 What Is JSON?
JSON is a text-based data format originally from JavaScript but now used everywhere.
It’s used in APIs, logs, configurations, and cloud platforms like AWS and Azure.
🟦 JSON Example: User Profile
{
"name": "Ada",
"email": "ada@example.com",
"skills": ["Linux", "Docker", "Git"],
"active": true
}
🧠 What You Should Notice:
Curly braces
{}
wrap objectsSquare brackets
[]
wrap listsAll keys must be quoted
Boolean values are lowercase (
true
,false
)
🆚 YAML vs JSON: At a Glance
Feature | YAML | JSON |
Readability | More human-friendly 🟢 | More machine-friendly 🔵 |
Syntax | Indentation-based | Brackets & quotes |
File type | .yaml , .yml | .json |
Usage | Kubernetes, CI/CD | APIs, logs, config |
Comments | Yes (# Comment ) | No native support ❌ |
🧪 Try It Yourself!
✅ YAML Practice:
Create a Docker Compose file:
version: "3"
services:
web:
image: nginx
ports:
- "80:80"
✅ JSON Practice:
Make a simple user.json
file:
{
"username": "devops_jane",
"level": "beginner",
"subscribed": true
}
💡 DevOps Tip:
Many tools can convert between YAML ↔ JSON.
Try: https://www.json2yaml.com
📌 TL;DR:
YAML = clean, readable configs
JSON = structured, widely supported data format
Master both — they’re everywhere in DevOps!
🔜 Coming Up: Day 13 – Intro to Linux for DevOps 🐧
We’ll look at file systems, commands, permissions, and Linux structure — everything a DevOps engineer should know.
Subscribe to my newsletter
Read articles from Badmus Faoziyat directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
