10 09/2014

YAML vs. JSON

最后更新: Wed Sep 10 2014 12:36:06 GMT+0800

JSON 格式

{
    "name":"guoshuang",
    "skills":{
        "html5":"good",
        "css":"perfect"
    }
}

YAML 格式

name: guoshuang
skills: 
  html5: good
  css: perfect

Both JSON and YAML aim to be human readable data interchange formats.

都是易读的数据交换格式

In contrast, YAML’s foremost design goals are human readability and support for serializing arbitrary native data structures. Thus, YAML allows for extremely readable files, but is more complex to generate and parse.

对比之下,YAML 更易读,支持序列化数据(串行处理),更复杂一些。

YAML can therefore be viewed as a natural superset of JSON

JSON可以看作YAML的一个子集

注意:还有个 YAML(Yet Another Multicolumn Layout) 是一个 html5+css 的框架,类似于 bootstrap 。和我们上面说的不是一回事。