YAML and JSON Basics: The Language of DevOps Configs

Badmus FaoziyatBadmus Faoziyat
3 min read

👋 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 lists

  • Colons : 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 objects

  • Square brackets [] wrap lists

  • All keys must be quoted

  • Boolean values are lowercase (true, false)

🆚 YAML vs JSON: At a Glance

FeatureYAMLJSON
ReadabilityMore human-friendly 🟢More machine-friendly 🔵
SyntaxIndentation-basedBrackets & quotes
File type.yaml, .yml.json
UsageKubernetes, CI/CDAPIs, logs, config
CommentsYes (# 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.

0
Subscribe to my newsletter

Read articles from Badmus Faoziyat directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Badmus Faoziyat
Badmus Faoziyat