YAML (YAML Ain't Markup Language)
YAML là ngôn ngữ tuần tự hóa dữ liệu thân thiện với con người, sử dụng thụt lề để biểu diễn cấu trúc thay vì dấu ngoặc hoặc thẻ. Nó là định dạng cấu hình thống trị cho DevOps và cơ sở hạ tầng đám mây.
Loại MIME
application/x-yaml
Loại
Văn bản
Nén
Không mất dữ liệu
Ưu điểm
- + Highly readable — minimal syntax noise
- + Supports comments for inline documentation
- + Native in Docker, Kubernetes, Ansible, and CI/CD systems
- + Superset of JSON — any JSON is valid YAML
Nhược điểm
- − Indentation-sensitive — whitespace errors cause silent failures
- − Implicit type coercion can cause bugs ('yes' becomes boolean true)
- − More complex specification than JSON with anchors, tags, and directives
Khi nào nên dùng .YAML
Sử dụng YAML cho tệp cấu hình, pipeline CI/CD, điều phối container và bất kỳ ngữ cảnh nào mà cấu hình dễ đọc được ưu tiên hơn tính chặt chẽ của máy.
Chi tiết kỹ thuật
YAML sử dụng thụt lề (dấu cách, không phải tab) cho lồng nhau, dấu hai chấm cho cặp khóa-giá trị, dấu gạch ngang cho mảng và hỗ trợ neo/bí danh cho tham chiếu. YAML 1.2 là tập cha của JSON.
Lịch sử
Clark Evans, Ingy döt Net và Oren Ben-Kiki tạo ra YAML vào năm 2001. Tên viết tắt đệ quy ban đầu là "Yet Another Markup Language" trước khi đổi thành "YAML Ain't Markup Language".
Chuyển đổi từ .YAML
Chuyển đổi sang .YAML
Định dạng liên quan
Thuật ngữ liên quan
Learn More
JSON vs YAML vs TOML: Choosing a Configuration Format
Configuration files are the backbone of modern applications. JSON, YAML, and TOML each offer different trade-offs between readability, complexity, and …
How to Format and Validate JSON Data
Malformed JSON causes silent failures in APIs and configuration files. Learn how to format, validate, and debug JSON documents to …
Base64 Encoding: How It Works and When to Use It
Base64 converts binary data into ASCII text, making it safe for transmission through text-based systems. Learn when Base64 is the …
Best Practices for Working with Unix Timestamps
Unix timestamps provide a language-agnostic way to represent points in time, but they come with pitfalls around time zones, precision, …
Troubleshooting JWT Token Issues
JSON Web Tokens are widely used for authentication but can be frustrating to debug. This guide covers common JWT problems …
Hash Functions Compared: MD5, SHA-1, SHA-256, and Beyond
Hash functions are used for file integrity, password storage, and digital signatures. This comparison covers the most common algorithms, their …