YAML – Introduction
Pre-knowledge
Basically programming languages are divided into two types
Declarative programming can be defined as what a program can do rather than how it can be done.
Examples – HTML/CSS
Imperative programming can be defined as how a program can be accomplished.
Examples – C++, JAVA, Python and so on.
JSON, YAML and XML are generally considered as context-sensitive languages and comes under declarative programming language
YAML Definition
Benefits of YAML
-
YAML data can be portable with many programming languages like Perl, Python, PHP, Ruby and JavaScript.
-
It is easily readable and editable.
-
It can be easily implemented.
-
It consists of data consistent model.
-
It supports one-direction processing.
Comparisons
Comparison between YAML, JSON & XML
-
YAML has some advantages over JSON like self reference, support for complex datatypes, embedded block literals, comments, and more.
-
JSON is only readable whereas YAML can be readable as well as editable.
-
JSON is a subset of YAML so that YAML parsers can be able to parse JSON.
-
YAML doesn’t use any extra delimiters. So it is light-weight than XML and JSON.
Did You Know ?
YAML file is case-sensitive and you can save the YAML file in .yaml or .yml extension. YAML doesn’t allow any tabs while creating a YAML file.