标签:编程语言 https 空格 发音 并且 序列化 val dash new
http://yaml.org/
YAML: YAML Ain‘t Markup Language What It Is: YAML is a human friendly data serialization standard for all programming languages.
YAML(Yet Another Markup Language)(发音 /?jæm?l/ )
一种基于Unicode容易阅读,容易和脚本语言交互的,用来表达资料序列的编程语言。
本文介绍 YAML 的语法,以 JS-YAML 的实现为例。你可以去在线 Demo 验证下面的例子。
YAML 支持的数据结构有三种。
- 对象:键值对的集合,又称为映射(mapping)/ 哈希(hashes) / 字典(dictionary)
- 数组:一组按次序排列的值,又称为序列(sequence) / 列表(list)
- 纯量(scalars):单个的、不可再分的值
以下分别介绍这三种数据结构。
一组连词线开头的行,构成一个数组。
- Cat - Dog - Goldfish
转为 JavaScript 如下。
[ ‘Cat‘, ‘Dog‘, ‘Goldfish‘ ]
数据结构的子成员是一个数组,则可以在该项下面缩进一个空格。
- - Cat - Dog - Goldfish
转为 JavaScript 如下。
[ [ ‘Cat‘, ‘Dog‘, ‘Goldfish‘ ] ]
数组也可以采用行内表示法。
animal: [Cat, Dog]
转为 JavaScript 如下。
{ animal: [ ‘Cat‘, ‘Dog‘ ] }
american:
- Boston Red Sox
- Detroit Tigers
- New York Yankees
national:
- New York Mets
- Chicago Cubs
- Atlanta Braves
标签:编程语言 https 空格 发音 并且 序列化 val dash new
原文地址:https://www.cnblogs.com/youxin/p/9746013.html