有哪些好的替代序列化格式?
我过去曾使用过 XML,但它非常冗长且笨重。我们目前正在使用 YAML,但我发现大多数开发人员在空白方面遇到很多麻烦。是否有类似 YAML 的格式,对空格不敏感,但又不像 XML 那样冗长?
I have used XML in the past, but it is very verbose and clunky. We are currently using YAML, but I am finding that most developers have alot of trouble with the whitespace. Is there a YAML like format that is whitespace insensitive, but not as verbose as XML?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不必在 YAML 中使用空格语法。所有数据结构也都有非空白替代品,例如序列
[1, 2, 3]
和映射{ key: value, k: v }
。这称为流样式,而不是 >块样式。另一种选择可能是 JSON,它实际上是 YAML 的子集。它基本上是没有块样式且没有可扩展性的 YAML。
标准 Lisp 列表语法(列表由括号分隔,元素由空格分隔)也是一种非常好的格式。
You don't have to use the whitespace syntax in YAML. All the datastructures also have non-whitespace alternatives, e.g. sequences
[1, 2, 3]
and maps{ key: value, k: v }
. This is called flow style as opposed to block style.An alternative might be JSON, which is actually a subset of YAML. It's basically YAML without block style and without extensibility.
Standard Lisp list syntax (list delimited by parentheses, elements separated by whitespace) is also a very nice format.
我建议查看 TOML。不区分大小写,但仍然解决了 YAML 中所有复杂的问题。
I recommend checking out TOML. Not case-insensitive, but nevertheless fixing all the problems with complexity in YAML.