Pi _ yaml - dwisianto/dwisianto GitHub Wiki

y1a.yaml


#
# Reference
#
some_thing: &VAR_NAME foobar
other_thing: *VAR_NAME


#
# inheritance
#
parent: &defaults
  a: 2
  b: 3

child:
  <<: *defaults
  b: 4

#
#
#
values: &ref
  - Will be
  - reused below

other_values:
  i_am_ref: *ref

y1a.json

{
  "child": {
    "a": 2,
    "b": 4
  },
  "other_thing": "foobar",
  "other_values": {
    "i_am_ref": [
      "Will be",
      "reused below"
    ]
  },
  "parent": {
    "a": 2,
    "b": 3
  },
  "some_thing": "foobar",
  "values": [
    "Will be",
    "reused below"
  ]
}

---

parent: &defaults
  a: 2
  b: 3

child:
  <<: *defaults
  b: 4

---

some_thing: &VAR_NAME foobar
other_thing: *VAR_NAME

values: &ref
  - Will be
  - reused below

other_values:
  i_am_ref: *ref

data.yaml

a list:
- 1
- 42
- 3.141
- 1337
- help
- €
a string: bla
another dict:
  foo: bar
  key: value
  the answer: 42

conf2.yaml

---
 doe: "a deer, a female deer"
 ray: "a drop of golden sun"
 pi: 3.14159
 xmas: true
 french-hens: 3
 calling-birds:
   - huey
   - dewey
   - louie
   - fred
 xmas-fifth-day:
   calling-birds: four
   french-hens: 3
   golden-rings: 5
   partridges:
     count: 1
     location: "a pear tree"
   turtle-doves: two