Documentation

    Table of Content
    • 3D File Formats
      • 3D File Formats
      • 3D2
      • 3DS
      • 3MF
      • AMF
      • ASE
      • DAE
      • DRC
      • FBX
      • GLB
      • GLTF
      • JRXML
      • JT
      • OBJ
      • PLY
      • PRC
      • RVM
      • STEP
      • U3D
      • VRML
      • X
      • X3D
    • Audio File Formats
      • Audio File Formats
      • AAC
      • FLAC
      • M3U
      • MID
      • MKA
      • MP3
      • OGG
      • RA
      • SDT
      • STAP
      • WAV
    • CAD File Formats
      • CAD File Formats
      • CF2
      • DC3
      • DGN
      • DWF
      • DWFX
      • DWG
      • DWT
      • DXF
      • HPGL
      • IFC
      • IGES
      • IGS
      • JVSG
      • NWC
      • NWD
      • NWF
      • PAT
      • PHJ
      • PLT
      • PSM
      • PSS
      • RVT
      • STL
    • Compression File Formats
      • Compression File Formats
      • 7Z
      • ARC
      • ARJ
      • BZ2
      • DAA
      • GZ
      • RAR
      • TAR
      • ZIM
      • ZIP
    • Database
      • Database File Formats
      • ACCDB
      • ACCDE
      • ACCDT
      • ACCFT
      • BAK
      • BCP
      • DDL
      • DTSX
      • LDF
      • MDB
      • MDF
      • MYI
      • NDF
      • NSF
      • SQL
      • SQLITE
    • EBook File Formats
      • EBook File Formats
      • AZW
      • AZW3
      • EPUB
      • FB2
      • KFX
      • LRF
      • LRS
      • LRX
      • MOBI
      • TR
    • Email File Formats
      • Email File Formats
      • EDB
      • EML
      • EMLX
      • ICS
      • MBOX
      • MSG
      • OFT
      • OST
      • PST
      • TNEF
      • VCF - Virtual Contact File
    • Font
      • Font File Formats
      • CFF
      • CFF2
      • EOT
      • FNT
      • FON
      • JFPROJ
      • OTF
      • PFA
      • PFB
      • PFM
      • SFD
      • TTF
      • WOFF
    • GIS File Formats
      • GIS File Formats
      • E00
      • FileGDB
      • GeoJSON
      • GML
      • GPX
      • KML
      • KMZ
      • OSM
      • SHP
    • Image File Formats
      • Image File Formats
      • APNG
      • AVIF
      • BMP
      • CDR
      • CMX
      • DCM
      • DIB
      • DICOM
      • DJVU
      • DNG
      • EMF
      • EMZ
      • EXIF
      • GIF
      • ICO
      • J2K
      • JP2
      • JPEG
      • JXR
      • ODG
      • OTG
      • PNG
      • PSB
      • PSD
      • SVGZ
      • TGA
      • TIFF
      • VDX
      • VSD
      • VSDM
      • VSDX
      • VSS
      • VSSM
      • VSSX
      • VST
      • VSTM
      • VSTX
      • VSX
      • VTX
      • WEBP
      • WMF
      • WMZ
    • Note Taking File Formats
      • Note Taking File Formats
      • ONE
      • ONETOC2
    • Page Description Language
      • Page Description Language
      • CGM
      • EPS
      • PCL
      • PS
      • SVG
      • SWF
      • TEX
      • XPS
      • XSLFO
    • PDF
      • PDF
      • PDF/A
      • PDF/E
      • PDF/UA
      • PDF/VT
      • PDF/X
    • Presentation File Formats
      • Presentation File Formats
      • ODP
      • OTP
      • POT
      • POTM
      • POTX
      • PPS
      • PPSM
      • PPSX
      • PPT
      • PPTM
      • PPTX
    • Programming
      • Programming
      • C
      • Class
      • CPP
      • CS
      • CSPROJ
      • Dart
      • H
      • JAR
      • Java
      • KT
      • MF
      • PDB
      • PHP
      • PY
      • SH
      • SLN
      • SWIFT
      • TOML
      • VB
      • VBPROJ
      • VCXPROJ
      • YAML
    • Project Management File Formats
      • Project Management File Formats
      • MPP
      • MPT
      • MPX
      • XER
    • Spreadsheet File Formats
      • Spreadsheet File Formats
      • CSV
      • DIF
      • ODS
      • OTS
      • TSV
      • XLAM
      • XLM
      • XLS
      • XLSB
      • XLSM
      • XLSX
      • XLT
      • XLTM
      • XLTX
    • Video File Formats
      • Video File Formats
      • 3G2
      • 3GP
      • AVI
      • F4V
      • FLV
      • M4V
      • MKV
      • MOV
      • MP4
      • RM
      • RMVB
      • RV
      • SRT
      • VOB
      • WMV
      • Xvid
    • Web File Formats
      • Web File Formats
      • ASP
      • ASPX
      • CHM
      • CSS
      • HTM
      • HTML
      • JS
      • JSON
      • MHTML
      • Sass
      • SCSS
      • VDW
      • XAML
      • XHTML
      • XML
      • XOML
      • XSLT
    • Word Processing File Formats
      • Word Processing File Formats
      • DOC
      • DOCM
      • DOCX
      • DOT
      • DOTM
      • DOTX
      • MD
      • ODT
      • OTT
      • RTF
      • TXT

    What's on this Page

      • What is a YAML file?
      • Brief History
      • How to open YAML files
      • YAML File Format
        • Syntax
      • References
    1. Home
    2. Programming
    3. YAML

    What is a YAML file?

    YAML (YAML Ain’t Markup Language) is a Unicode based data-serialization language that is used for configuration files, internet messaging, object persistence, etc. YAML uses the .yaml extension for its files. YAML was designed to work well with modern programming languages.

    Brief History

    YAML was first proposed in 2001 and was developed by Clark Evans, Ingy döt Net, and Oren Ben-Kiki. YAML was first said to mean “Yet Another Markup Language” to indicate its purpose as a markup language. It was later repurposed as “YAML Aint Markup Language” to indicate its purpose as data-oriented.

    How to open YAML files

    To open YAML files, you can use the following:

    • Notepad
    • Notepad++
    • VS Code
    • Atom
    • IntelliJ IDEA

    YAML File Format

    YAML file consists of the following data types

    • Scalars: Scalars are values like Strings, Integers, Booleans, etc.
    • Sequences: Sequences are lists with each item starting with a hyphen (-). Lists can also be nested.
    • Mappings: Mapping gives the ability to list keys with values.

    Syntax

    • Whitespace: Whitespace indentation is used to indicate nesting and overall structure.

      name: John Smith
      contact:
          home:   1012355532
          office:  5002586256
      address:
        street: |
                  123 Tornado Alley
                  Suite 16
          city:   East Centerville
          state:  KS
      
    • Comments: Comments are written beginning with the “#” symbol.

      # This is a YAML Comment
      
    • Lists: Hyphen (-) is used to indicate list members with each member on a separate line. List members can also be enclosed in square brackets ([…]) with members separated by commas (,).

      - A
      - B
      - C
      
      [A, B, C]
      
    • Associative Array: An associative array is surrounded by curly brackets ({…}). The keys and values are separated by colon(:) and each pair is separated by comma (,).

      {name: John Smith, age: 20}
      
    • Strings: String can be written with or without double-quotes (") or single-quotes (').

      Sample String
      "Sample String"
      'Sample String'
      
    • Scalar Block content: Scalar content can be written in block notation by using the following:

      • |: All live breaks are significant.
      • >: Each line break is folded to space. It removes the leading whitespace for each line.
      data: |
        YAML 
          (YAML Ain't Markup Language)
        is a data-serialization language
      
      data: ?
        YAML (YAML Ain't Markup Language)
        is a data-serialization language
      
    • Multiple Documents: Multiple documents are separated by three hyphens (—) in a single stream. Hyphens indicate the start of the document. Hyphens are also used to separate directives from document content. The end of the document is indicated by three dots (…).

      ---
      Document 1
      ---
      Document 2
      ...
      
    • Type: To specify the type of value, double exclamation marks (!!) are used.

      a: !!float 123
      b: !!str 123
      
    • Tag: To assign a tag to a note, an ampersand (&) is used and to reference that node, an asterisk (*) is used.

      name: John Smith
      bill-to:  &id01
        street: |
                123 Tornado Alley
                Suite 16
        city:   East Centerville
        state:  KS
      
      ship-to:  *id01
      
    • Directives: YAML documents can be preceded by directives in a stream. Directives begin with a percent sign (%) followed by the name and then the parameters separated by spaces.

      %YAML 1.2
      ---
      Document content
      

    References

    • YAML - Wikipedia
    • YAML

    See Also

    • KT File Format
    • PY File Format
    • Xvid File Format
    • F4V File Format
    • AVIF File Format