YML file extension can use .yml or .yaml.
Configure common data
Syntax: key: value
name: haohao
Note: there is a space before value
Configuration object data
key:
key1: value1
key2: value2
或者:
key: {key1: value1,key2: value2}
Sample code:
person:
name: haohao
age: 31
addr: beijing
#或者
person: {name: haohao,age: 31,addr: beijing}
Note: The number of spaces in front of key1 is not limited. In yml syntax, the same indentation represents the same level
Configuration array (List, Set) data
syntax:
key:
- value1
- value2
或者:
key: [value1,value2]
Sample code:
city:
- beijing
- tianjin
- shanghai
- chongqing
#或者
city: [beijing,tianjin,shanghai,chongqing]
#集合中的元素是对象形式
student:
- name: zhangsan
age: 18
score: 100
- name: lisi
age: 28
score: 88
- name: wangwu
age: 38
score: 90