In this article will talk about the Yaml and how we can use that.
Table of Contents
What is Yaml?
It is a data serialization language. Its can easily by understand by humans. yaml usually used in writing the configuration files for the server, Database, etc. Yaml stand for yet another Markup Language.
In yaml we need to be extra cautious about the indentation.
Basic Yaml Syantax
In order to understand the Yaml Syntax we need to understand few things:
- Key value pair
- Array/List
- Dictionary/Map
Key value pair
In key value pair we have one key and one value and we can understand that from the below example:
Example#1:
Fruit: Apple
Vegetable: Carrot
Liquid: Water
Example#2:
Meat: Mutton
Laptop: Dell
Mobile: Mi
Array/ List
It is a collection of similar type of data or we can also say that its a collection of ordered data. We can understand the Array/List from the below examples:
Example#1:
Fruits:
-Mango
-Apple
-Banana
-Grapes
Example#2:
vegetables:
– Carrot
-Brinjal
-Patato
Dictionary/Maps
Its a collection of the unordered data Or we can also say that in this will talk about the different attributes of a key and you can understand that from the below example:
Example#1:
Banana:
calories: 105
fat: 0.4
carbs: 27
Example#2:
Mobile:
Brand: Mi
Model no: POCO X2
Battery: 5000mah
Camera: 48MP