memect/kg-beijing

Why JSON beats YAML?

x1angli opened this issue · 2 comments

Hello ,

Since you mentioned

JSON/REST在和XML/SOAP的竞争中胜利不是偶然的。JSON成为Web API的事实标准

Also, YAML may be a "superset" of JSON, meaning YAML has more features. Plus YAML is more concise, but why did JSON become the defacto standard of Web API?

Thanks

我的理解

1 json主要用来做数据交换,所以 { } 很有用。yaml用空格和换行,网络传输不经济

2 yaml解析慢很多

3 yaml的高级功能如节点引用可能对大多数Web API用不到。JSON够用了

4 历史原因。2005年前后Yahoo开始用JSON作为Web API的格式。也许他们那时候不知道Yaml,或者json对他们已经足够用了。然后就路径依赖。

5 JSON被营销为Javscript的一个子集,更容易被市场接受。

I believe no.4. "promoted by Yahoo" should be the main reason.

IMHO, referencing is a desirable feature. When coding w/ JSON, I have always been wondering how to enrich it to support cross-referencing.