是一个可读性高,用来表达数据序列的格式。YAML的意思其实是:仍是一种标记语言,但为了强调这种语言以数据做为中心,而不是以标记语言为重点
name: Steve
age: 18
hash: { name: Steve, age: 18 }
animal
- Cat
- Dog
animal: [Cat, Dog]
1 languages:
2 - Ruby
3- Perl
4 - Python
5 websites:
6 YAML: yaml.org
7 Ruby: ruby-lang. org
8 Python: python.org
9 Perl: use.per1.org
1字符串布尔值整数浮点数Null
2时间日期
数值直接以字面量的形式表示
number: 12.30
布尔值用true和false表示
isSet: true
null用~表示
parent: ~
时间采用IS08601格式
iso8601: 2001-12-14t21:59:43.10-85:00
日期采用复合iso8601格式的年、月、日表示
date: 1976-07-31
YAML允许使用两个感叹号,强制转换数据类型
e: !!str 123
f: !!str true
str:这是一行字符串
str: '内容: 字符串‘
s1: '内容\n字符串’
S2: "内容\n字符串"
Istr: 'labor''s day'
str:这是一段
多行
字符串
this: |
Foo
Bar
that: >
Foo
Bar
s1: |
Foo
s2: |+
Foo
s3: |-
Foo