빠른 참조

YAML 문법 치트시트

YAML 문법 빠른 참조 가이드: 딕셔너리(매핑), 리스트, 여러 줄 문자열 스칼라, 앵커, 별칭 및 병합 키 정리.

· 게시일

YAML(YAML Ain't Markup Language)은 모든 프로그래밍 언어에서 사용할 수 있는 사람이 읽기 쉬운 데이터 직렬화 표준입니다.

딕셔너리와 리스트

# Comments begin with "#"
# Dictionaries are written as "key: value"
name: Martin D'vloper
languages:
  perl: Elite
  python: Elite
  pascal: Basic

# List items begin with "- "
foods:
  - Apple
  - Orange
  - Strawberry
  - Mango

# Booleans use lowercase
employed: true

여러 줄 문자열

# Literal Block Scalar (preserves newlines)
multiline_literal: |
  exactly as you see
  will appear these three
  lines of poetry
# Folded Block Scalar (folds newlines to spaces)
multiline_folded: >
  this is really a
  single line of text
  despite appearances

앵커와 상속

parent: &defaults
  a: 2
  b: 3

child:
  <<: *defaults
  b: 4

재사용 가능한 시퀀스

values: &ref
  - These values
  - will be reused below

other_values:
  <<: *ref

관련 주제