未来会有什么格式会淘汰 json 吗?

2021-08-06 13:12:39 +08:00
 find456789

我个人感觉 json 有一个很大的弊端就是 里面不能写注释

有时候想给 package.json 加注释,不好加

6222 次点击
所在节点    问与答
63 条回复
ily433664
2021-08-07 09:26:55 +08:00
json 和 yaml 的主要用途又不一样,json 主要是方便传输数据,yaml 主要是配置文件,两个方向都不同怎么替代
3dwelcome
2021-08-07 12:49:18 +08:00
textures/bwhtest/foo
{
// draw the lightmap first
{
map $lightmap
rgbGen identity
}
// modify the lightmap in the framebuffer by
// a highly compressed detail texture
{
map textures/details/detail01.tga
blendFunc GL_DST_COLOR GL_SRC_COLOR
// YOU MUST USE THIS!!
detail
// for the detail to be disabled, this must be present
tcMod scale 9.1 9.2
}
// now slap on the base texture
{
map textures/castle/blocks11b.tga
blendFunc filter
}
}

这是 20 年前的古人写的 quake3 配置文件,1999 年的主流游戏,后来开源,时间线一点不夸张。

怎么看都有清晰的注释和层级结构,不比 json 差很多(重点是没有逗号!)

之所以 JSON 那么火,就仅仅是因为它是 Javascript 的原生对象,没别的理由了。
yimity
2021-08-08 22:14:15 +08:00
@binux
{
"//注释 A" : "a",
"a" : "a",
"//注释 B" : "b",
"b" : "b"
}

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/794059

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX