ScanSkill

YAML

The data exchange format for storing and sending the information is called YAML, which stands for YAML Ain't Markup Language. Since all legitimate JSON documents are also legitimate YAML files, it is a tight superset of JSON.

YAML may accomplish many of the same tasks as XML or JSON. The key distinction is that it strives to be brief in syntax and punctuation to make it easier to write by hand rather than having it created by a computer.

Docker-compose file uses YAML as a configuration language.

How data is encoded in YAML?

An object (which consists of key-value pairs) and an array are the two top-level elements of YAML (which consists of an ordered set of values). Values can be any of the following types, although keys can only be strings:

  • object: a collection of key-value pairs. Each key is followed by a :
  • array: an ordered list of values, with a `` preceding each item
  • string: an ordered sequence of text, optionally enclosed in ' ' or " "
  • number: a numeric value expressed in decimal, with exponent notation allowed
  • boolean: true or false
  • null is the implicit value where any value does not follow the colon
  • comments are any content in a line after # which the parser ignores

Example

company:
  name: Cloudyfox
  login: clodyfoxlabs
repo:
  name: internal-server-conf
  activelyMaintained: true
  stats:
  - type: stars
    count: 20
  - type: forks
    count: 50