JSONYAMify

Home / Blog / Apa itu YAML?

Apa itu YAML? Pengertian, Sintaks, dan Contoh Penggunaannya

Oleh Andi Putra Ogie · Update: Juni 2026 · 5 menit baca

YAML ("YAML Ain't Markup Language") adalah format serialisasi data yang dirancang agar mudah dibaca manusia. Tidak seperti JSON yang mengandalkan kurung kurawal dan tanda kutip, YAML menggunakan indentasi spasi untuk menunjukkan struktur data — mirip seperti Python.

Contoh Sintaks YAML

server:
  host: 0.0.0.0
  port: 8080
  debug: true

database:
  engine: postgres
  replicas:
    - primary
    - replica-1
    - replica-2

Perhatikan: tidak ada kurung kurawal, tidak ada tanda kutip wajib pada key, dan tidak ada koma di akhir baris. Struktur bersarang ditentukan murni oleh jumlah spasi indentasi (disarankan 2 spasi, jangan pakai tab).

Fitur Khas YAML yang Tidak Ada di JSON

Di Mana YAML Biasa Dipakai?

YAML adalah standar de-facto untuk file konfigurasi infrastruktur modern: docker-compose.yml, manifest Kubernetes, workflow GitHub Actions/GitLab CI, Ansible playbook, dan konfigurasi banyak framework backend. Karena lebih enak dibaca manusia dibanding JSON, YAML jadi favorit untuk file yang sering diedit manual oleh developer/DevOps.

Jebakan Umum YAML

  1. Tab vs spasi — YAML tidak menerima karakter tab untuk indentasi, harus spasi.
  2. Norway Problem — nilai no, yes, on, off tanpa kutip bisa otomatis diparse jadi boolean, bukan string (terjadi pada parser YAML 1.1, termasuk kode negara "NO" untuk Norwegia yang berubah jadi false).
  3. Indentasi tidak konsisten — beda jumlah spasi antar level bisa membuat parser error atau salah baca struktur.
💡 Mau ubah YAML konfigurasi jadi JSON (atau sebaliknya) tanpa pusing soal indentasi? Paste langsung di JSONYAMify — konversi dua arah otomatis dengan validasi.
🔧 Konversi JSON ↔ YAML di JSONYAMify

What is YAML? Meaning, Syntax, and Use Cases

By Andi Putra Ogie · Updated: June 2026 · 5 min read

YAML ("YAML Ain't Markup Language") is a data serialization format designed to be human-readable. Unlike JSON, which relies on curly braces and quotation marks, YAML uses space indentation to represent structure — similar to Python.

YAML Syntax Example

server:
  host: 0.0.0.0
  port: 8080
  debug: true

database:
  engine: postgres
  replicas:
    - primary
    - replica-1
    - replica-2

Notice: no curly braces, no mandatory quotes on keys, and no trailing commas. Nesting is determined purely by indentation depth (2 spaces is recommended, never use tabs).

YAML Features Not Found in JSON

Where Is YAML Commonly Used?

YAML is the de-facto standard for modern infrastructure config files: docker-compose.yml, Kubernetes manifests, GitHub Actions/GitLab CI workflows, Ansible playbooks, and many backend framework configs. Because it's more pleasant for humans to read than JSON, it's the go-to choice for files developers and DevOps engineers edit by hand often.

Common YAML Pitfalls

  1. Tabs vs spaces — YAML rejects tab characters for indentation; spaces only.
  2. The "Norway Problem" — unquoted no, yes, on, off get auto-parsed as booleans instead of strings (a YAML 1.1 quirk — the country code "NO" famously becomes false).
  3. Inconsistent indentation — mismatched spacing between levels causes parser errors or misread structures.
💡 Want to convert a YAML config to JSON (or vice versa) without fighting indentation? Paste it straight into JSONYAMify — bidirectional conversion with built-in validation.
🔧 Convert JSON ↔ YAML on JSONYAMify