DevNet Associate DEVASC 200-901 Official Certification Guide by Adrian Iliesiu (z-lib.org)

(andrew) #1
},
{
"desk": true
},
{
"lights": "On"
}
]
}}

YAML


YAML is an acronym that stands for “YAML Ain’t
Markup Language.” According to the official YAML site
(https://yaml.org), “YAML is a human-friendly data
serialization standard for all programming languages.”


YAML is a data serialization language designed for
human interaction. It’s a strict superset of JSON, another
data serialization language. But because it’s a strict
superset, it can do everything that JSON can do and
more. One significant difference is that newlines and
indentation mean something in YAML, whereas JSON
uses brackets and braces to convey similar ideas. YAML
uses three main data formats:


Scalars: The simplest is a keyvalue view.
Lists/sequences: Data can be ordered by indexes.
Dictionary mappings: These are similar to scalars but can contain
nested data, including other data types.

Example 7-3 shows a sample YAML response document.
As you can see, the response is very straightforward and
human readable. If you are interested in seeing the status
of the lights in study_room, you find the study_room
section and then look for the value of lights.


Example 7-3 YAML Data Format

---
home:


  • this is my house

  • located in San Jose, CA

Free download pdf