Difference between revisions of "YAML"

From Teknologisk videncenter
Jump to: navigation, search
m
m
Line 24: Line 24:
 
<source lang=yaml>
 
<source lang=yaml>
 
address: {street: "H.C. Andersens vej 9",  city: Viborg,  zip: 8800 }
 
address: {street: "H.C. Andersens vej 9",  city: Viborg,  zip: 8800 }
 +
</source>
 +
=Data types=
 +
==Scalars==
 +
*Strings
 +
**"This is a string"
 +
**'This is also a string'
 +
**This is a string too
 +
**"2999"
 +
*Numbers
 +
**2999
 +
**2e+10
 +
*Booleans
 +
**true
 +
**false
 +
*Dates
 +
**"2025-01-01"    # ISO-8601 standard
 +
*Null
 +
**  Name: null
 +
**  Name: ~
 +
**  Name:
  
</source>
+
==Strings==

Revision as of 11:22, 12 December 2023

Structure

Block and flow style

Block style

Lists:

fruits:
  - apple
  - banana
  - orange

Maps/dictionary:

address:
  street: "H.C. Andersens vej 9"
  city: Viborg
  zip: 8800

Flow style

Lists:

fruits: [apple, banana, orange]

Maps:/dictionary:

address: {street: "H.C. Andersens vej 9",  city: Viborg,  zip: 8800 }

Data types

Scalars

  • Strings
    • "This is a string"
    • 'This is also a string'
    • This is a string too
    • "2999"
  • Numbers
    • 2999
    • 2e+10
  • Booleans
    • true
    • false
  • Dates
    • "2025-01-01" # ISO-8601 standard
  • Null
    • Name: null
    • Name: ~
    • Name:

Strings