YAML basic syntax

table of Contents

YAML

  • To ---begin to ...end.
  • Members of the same class (eg List elements) use -to identify.
  • Notes to #begin with.

Boolean

There is no strict restriction on the writing of boolean values.

create_key: yes
needs_agent: no
knows_oop: True
likes_emacs: TRUE
uses_cvs: false

String object

Use |line breaks, >ignored wrap.

include_newlines: |
            exactly as you see
            will appear these three
            lines of poetry

ignore_newlines: >
            this is really a
            single line of text
            despite appearances

List & Hash object

  • List
fruits:
    - Apple
    - Orange
    - Strawberry
    - Mango
  • Hash
martin:
    name: Martin D'vloper
    job: Developer
    skill: Elite
  • Mixed use of List and Map
- martin:
	name: Martin D'vloper
    job: Developer
    skills:
      - python
      - perl
      - pascal
- tabitha:
    name: Tabitha Bitumen
    job: Developer
    skills:
      - lisp
      - fortran
      - erlang
  • List, Hash shorthand
martin: {
    
    name: Martin D'vloper, job: Developer, skill: Elite}
fruits: ['Apple', 'Orange', 'Strawberry', 'Mango']

Guess you like

Origin blog.csdn.net/Jmilk/article/details/108553119