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:

Discussion (1)

Collapse
sid_ht profile image
SIDDHARTH SINHA

Hi Nana,

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