开发者

What are some good alternative serialization formats?

开发者 https://www.devze.com 2023-01-22 14:44 出处:网络
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

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 th开发者_运维知识库at is whitespace insensitive, but not as verbose as XML?


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.


I recommend checking out TOML. Not case-insensitive, but nevertheless fixing all the problems with complexity in YAML.

0

精彩评论

暂无评论...
验证码 换一张
取 消