Difference between revisions of "YAML"
From Teknologisk videncenter
(Created page with "=Structure= ==Block and flow style== ===Block style=== '''Lists:''' <source lang=yaml> fruits: - apple - banana - orange </source> '''Maps:''' <source lang=yaml> </source>") |
m (→Scalars) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
- orange | - orange | ||
</source> | </source> | ||
− | '''Maps:''' | + | '''Maps/dictionary:''' |
<source lang=yaml> | <source lang=yaml> | ||
+ | address: | ||
+ | street: "H.C. Andersens vej 9" | ||
+ | city: Viborg | ||
+ | zip: 8800 | ||
+ | </source> | ||
+ | ===Flow style=== | ||
+ | '''Lists:''' | ||
+ | <source lang=yaml> | ||
+ | fruits: [apple, banana, orange] | ||
+ | </source> | ||
+ | '''Maps:/dictionary:''' | ||
+ | <source lang=yaml> | ||
+ | address: {street: "H.C. Andersens vej 9", city: Viborg, zip: 8800 } | ||
+ | </source> | ||
+ | =Data types= | ||
+ | ==Scalars== | ||
+ | *Strings | ||
+ | **text1: "This is a string" | ||
+ | **text2: 'This is also a string' | ||
+ | **text3: This is a string too | ||
+ | **text4: "2999" | ||
+ | **text5: | #Multiline string - Preserve new line chars | ||
+ | Line1 | ||
+ | Line2 | ||
+ | **text6: > #Multiline string - Convert new line to space | ||
+ | Line1 | ||
+ | Line2 | ||
+ | *Numbers | ||
+ | **2999 | ||
+ | **2e+10 | ||
+ | *Booleans | ||
+ | **true | ||
+ | **false | ||
+ | *Dates | ||
+ | **"2025-01-01" # ISO-8601 standard | ||
+ | *Null | ||
+ | ** Name: null | ||
+ | ** Name: ~ | ||
+ | ** Name: | ||
− | + | ==Strings== |
Latest revision as of 10:26, 12 December 2023
Contents
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
- text1: "This is a string"
- text2: 'This is also a string'
- text3: This is a string too
- text4: "2999"
- text5: | #Multiline string - Preserve new line chars
Line1 Line2
- text6: > #Multiline string - Convert new line to space
Line1 Line2
- Numbers
- 2999
- 2e+10
- Booleans
- true
- false
- Dates
- "2025-01-01" # ISO-8601 standard
- Null
- Name: null
- Name: ~
- Name: