YAML References- YAML tutorial - YAML Example

Anchors &and aliases *can be used for reference.

---values:- &ref Something to reuse- *ref	# Reused content

1. Node for “Sammy Sosa” appears twice in this document

---hr:  - Mark McGwire  # Following node labeled SS  - &SS Sammy Sosarbi:  - *SS # Subsequent occurrence  - Ken Griffey

2. Merging Keys

defaults: &defaults   adapter: postgres   host: localhostdevelopment:   database: myapp_development   <<: *defaultstest:   database: myapp_test   <<: *defaults

Equivalent JSON Code:

{ "defaults": {    "adapter": "postgres",    "host": "localhost" }, "development": {    "adapter": "postgres",    "host": "localhost" }, "test": {    "adapter": "postgres",    "host": "localhost" }}

&Used to create an anchor point ( defaults) <<that merges into the current data and is *used to refer to the anchor point.

3. Ancor point for current data

- &us USA - UK - INDIA - CHINA - *us

Equivalent JSON Code:

[ "USA", "UK", "INDIA", "CHINA", "USA"]