Skip to content

Instantly share code, notes, and snippets.

@franzwong
Last active August 19, 2019 02:02
Show Gist options
  • Save franzwong/b4db6fcfbb8295d2cc81d677994e8aac to your computer and use it in GitHub Desktop.
Save franzwong/b4db6fcfbb8295d2cc81d677994e8aac to your computer and use it in GitHub Desktop.
YAML cheatsheet

Array of objects

Multiple properties

Yaml

- id: 123456
  name: Luke
  title: Jedi Knight
- id: 123457
  name: Leia
  title: Princess

Javascript

[
  { id: 123456, name: 'Luke', title: 'Jedi Knight' },
  { id: 123457, name: 'Leia', title: 'Princess' }
]

Single property

Yaml

- name: Luke
- name: Leia
- name: Anakin

Javascript

[ { name: 'Luke' }, { name: 'Leia' }, { name: 'Anakin' } ]

Array of strings

# It looks similar to the 'single property' case of array of objects
# It is safer to put singe quote around the string
- 'Luke'
- 'Leia'
- 'Anakin'

Javascript

[ 'Luke', 'Leia', 'Anakin' ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment