YAML (YAML Ain’t Markup Language) is a human-readable data serialization language. It is often used for configuration files and data exchange between languages or systems. YAML has a simpler syntax than markup languages such as HTML or XML, and it allows for nested data structures using indentation rather than explicit tags.
Example:
---
name: Satyam Arya
age: 20
address:
street: 123456
city: Ghaziabad
state: UP
zip: 12345
--- # start of a new YAML document
# Skills (comment)
- HTML
- CSS
- JavaScript
- React
---
States:
- New Delhi
- Mumbai
- UP
---
States: [New Delhi, Mumbai]
... # indicates the end of a YAML document
In this example, the document contains key-value pairs and a nested data structure for the address. The colon character is used to separate keys from values, and indentation is used to indicate nesting.
YAML Validator – Click here
YAML into JSON convertor – Click here
Serialization language
Serialization language basically means that applications written with different technologies, languages etc. which have different data structures can transfer data to each other using a common agreed-on or a standard format
Some popular serialization languages include:
- JSON (JavaScript Object Notation): A lightweight data interchange format that is easy to read and write. It is often used for web applications and APIs.
- XML (Extensible Markup Language): A markup language used for storing and transporting data. It is often used for data exchange between different systems.
- YAML (YAML Ain’t Markup Language): A human-readable data serialization language that is often used for configuration files and data exchange between languages or systems.

Data Types
# String variables
name: Satyam Arya
firstName: "Satyam"
lastName: 'Arya'
bio: |
Keen observer who believes
in learning by sharing knowledge.
# write a single line in multiple lines
message: >
I like to accept challenges,
a quick learner and
self motivated.
number: 255
score: 90.50
# specify the type
zero: !!int 0
positiveNum: !!int 15
negativeNum: !!int -15
binaryNum: !!int 0b11001
octalNum: !!int 06574
hexa: !!int 0x45
commaValue: !!int +540_000 # 540,000
exponential numbers: 6.023E56
# floating point numbers
marks: !!float 28.50
infinite: !!float .inf
not_a_num: .nan
# null
surname: !!null Null # or null NULL ~
~: this is a null key
# date and time
date: !!timestamp 2002-12-14
More Data Types
student: !!seq
- marks
- name
- reg_no
# same as
student: !!seq [marks, name, reg_no]
# some keys of the seq will be empty
sparse seq:
- Html
- CSS
-
- JavaScript
- React
# nested sequence
-
- mango
- apple
- banana
-
- marks
- reg num
- name
# nested mappings: map within an map
name: Satyam Arya
role:
age: 20
job: student
# same as
name: Satyam Arya
role: { age: 20, job: student}
# pairs: keys may have duplicate values
pair example: !!pairs
- job: student
- job: teacher
# same as
pair example: !!pairs [job: student, job: teacher]
# !!set will allow you to have unique values
names: !!set
? Kunal
? Apoorv
? Rahul
# dictionary !!omap
people: !!omap
- Satyam:
name: Satyam Arya
age: 20
height: 170
- Rahul:
name: Rahul sharma
age: 21
height: 168
Reusing properties using anchors
likings: &likes
fav fruit: mango
dislike: banana
person1:
name: Satyam Arya
<<: *likes
person2:
name: Rahul sharma
<<: *likes
dislike: apple
# this will look like
person2:
name: Rahul sharma
fav fruit: mango
dislike: apple
In conclusion, YAML is a human-readable data serialization format that is often used for configuration files and data exchange between programming languages. It supports several data types, including scalars (strings, numbers, booleans, and null), sequences, and maps.