yaml 教程

来源:互联网 发布:苹果发布会 mac pro 编辑:程序博客网 时间:2024/06/16 08:28

一组连词线开头的行,构成一个数组。

- Cat- Dog- Goldfish

转为 JavaScript 如下。

[ ‘Cat’, ‘Dog’, ‘Goldfish’ ]
数据结构的子成员是一个数组,则可以在该项下面缩进一个空格。

- - Cat - Dog - Goldfish

转为 JavaScript 如下。

[ [ ‘Cat’, ‘Dog’, ‘Goldfish’ ] ]
数组也可以采用行内表示法。

animal: [Cat, Dog]
转为 JavaScript 如下。

{ animal: [ ‘Cat’, ‘Dog’ ] }

工具网站:
http://yaml-online-parser.appspot.com
http://www.yamllint.com

参考网站:
http://www.ruanyifeng.com/blog/2016/07/yaml.html?f=tt
http://yaml.org/spec/1.2/spec.html
http://einverne.github.io/post/2015/08/yaml.html#sequence