DEV Community

Cover image for YAML Tutorial for Beginners
TechWorld with Nana
TechWorld with Nana

Posted on • Updated on

YAML Tutorial for Beginners

YAML stands for YAML Ain't Markup Language and is a data serialization language.

Fun Fact: YAML originally meant Yet Another Markup Language ๐Ÿ˜‰
(If YAML ain't markup language, what is it?)

"After a few months of us working together, I pointed out that YAML (which most definitely stood for Yet Another Markup Language at that time) was not really a markup language (marking up various elements of a text document) but a serialization language (textual representation of typed/cyclical data graphs). We all liked the name YAML, so we backronymed it to mean YAML Ain't Markup Language."


What is YAML used for

In all my tutorial videos for Docker, Kubernetes, Ansible etc. I've used YAML for the example configuration files, because YAML has actually become a widely used format for writing configurations files.

One of the reasons for its popularity is that the language is human-readable, intuitive and flexible. ๐Ÿ’ช๐Ÿผ In fact, it can be used with nearly any application that needs to store or transmit data.

YAML compared to other JSON and XML

YAML compared to JSON and XML

YAML is a superset of JSON, which means any valid JSON file is also a valid YAML file ๐Ÿ’ก

YAML Syntax

โ–บ The basic building block of YAML documents are key-value pairs
โ–บ Indentation is used to denote structure
โ–บ Tabs are not allowed

In the below YAML tutorial I demonstrate the basic syntax:

  • key-value pairs
  • comments
  • objects
  • lists
  • boolean
  • more about lists
  • Multi-line strings
  • environment variables
  • placeholders
  • multiple yaml documents

I demonstrate the language syntax with real Kubernetes configuration files.

Check it out here ๐Ÿค“


Like, share and follow me ๐Ÿ™‚ for more content:

Latest comments (1)

Collapse
 
sid_ht profile image
SIDDHARTH SINHA

Hi Nana,

How is YAML better in data serialization in compared to JSON ?