DEV Community

Cover image for YAML Data Types
Md Abu Musa
Md Abu Musa

Posted on

YAML Data Types

YAML file containing different data types such as strings, numbers, lists, dictionaries, booleans, and null values:

# Example YAML file with various data types

# Strings
name: John Doe
occupation: Software Engineer

# Integers and Floats
age: 30
salary: 75000.50

# Booleans
is_active: true
is_manager: false

# Null value
nickname: null

# Lists
skills:
  - PHP
  - Laravel
  - JavaScript
  - Docker
  - AWS

# Dictionary
address:
  street: 123 Main St
  city: New York
  state: NY
  zip_code: 10001

# Nested Lists and Dictionaries
education:
  - degree: B.Sc in Computer Science
    university: University of XYZ
    graduation_year: 2015
  - degree: M.Sc in Software Engineering
    university: ABC Institute
    graduation_year: 2018

# Complex Dictionary with Multiple Data Types
project_details:
  project_name: AI Chatbot
  duration_in_months: 6
  completed: true
  team_members:
    - name: Alice
      role: Team Lead
    - name: Bob
      role: Developer
    - name: Charlie
      role: Tester
Enter fullscreen mode Exit fullscreen mode

This file illustrates how you can structure YAML to represent various data types and organize them in a readable manner.

Top comments (0)