A very basic guide to YAML

Vibhanshu SinghVibhanshu Singh
2 min read

YAML: Yet Another Markup Language [Previous]
YAML: YAML Ain’t Markup Language (RECURSIVE it is 😅) [Nowadays]
Example of Markup Language: HTML
Q: What is the use of markup language?
A: It provides child-parent relations.

  • Not a programming language.

  • Basically, a data format used to exchange data.

  • Similarly, like XML and JSON data types.

  • A simple human-readable language to represent data.

  • In YAML, you can only store data and not commands.

  • Storing data in YAML, XML, or JSON is known as data realization.

  • Extensions used: .yml or .yaml

  • It is case-sensitive.

  • We can store key-value pairs.

  • Indentation is also important.

  • It does not support multi-line comments.

  • It automatically detects data type.

Note: If we have data say in Android and we have to share that data to, say, a web app or say a ML model, so how do we do that? Here comes the concept of serialization and de-serialization.

  • Serialization is the process of converting data objects into complex data structures or into streams of bytes.

  • De-serialization is the process of converting complex data structures or streams of bytes into data objects (reverse of serialization).

Note: The reason for the full form change is because markup languages store only documents, but this also stores data objects.

Q: What type of data is being stored in YAML files?
A: It stores logs, caches, and configuration files of Docker, Kubernetes, etc.

Benefits:

  • Simple, human-readable, and easy to read.

  • Nice syntax.

  • Easily convertible to JSON, XML, and file formats.

  • Wide use.

  • Most powerful when it comes to representing complex data.

  • Parsing (reading the data) is easy.

Note: This is NOT a professional blog.

0
Subscribe to my newsletter

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

Written by

Vibhanshu Singh
Vibhanshu Singh