json的紧凑二进制表示 [英] compact binary representation of json

查看:29
本文介绍了json的紧凑二进制表示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何 JSON 的紧凑二进制表示?我知道有 BSON,但即使是那个网页也说在许多情况下并不比 JSON 高效.在某些情况下 BSON使用比 JSON 更多的空间".

Are there any compact binary representations of JSON out there? I know there is BSON, but even that webpage says "in many cases is not much more efficient than JSON. In some cases BSON uses even more space than JSON".

我正在寻找一种尽可能紧凑的格式,最好是某种开放标准?

I'm looking for a format that's as compact as possible, preferably some kind of open standard?

推荐答案

是的:微笑 数据格式(参见 维基百科条目.它有公共 Java 实现,C 版本在 github (libsmile) 的作品中.它的好处是比 JSON 更紧凑(可靠),但它是 100% 兼容的逻辑数据模型,因此可以轻松地与文本 JSON 来回转换.

Yes: Smile data format (see Wikipedia entry. It has public Java implementation, C version in the works at github (libsmile). It has benefit of being more compact than JSON (reliably), but being 100% compatible logical data model, so it is easy and possible to convert back and forth with textual JSON.

对于性能,您可以查看 jvm-serializers 基准,其中微笑竞争与其他二进制格式(thrift、avro、protobuf)配合得很好;sizewise 它不是最紧凑的(因为它确实保留了字段名称),但在名称重复的数据流中做得更好.

For performance, you can see jvm-serializers benchmark, where smile competes well with other binary formats (thrift, avro, protobuf); sizewise it is not the most compact (since it does retain field names), but does much better with data streams where names are repeated.

它被 Elastic Search 和 Solr 等项目使用(可选),Protostuff-rpc 支持它,尽管它不像 Thrift 或 protobuf 那样广泛.

It is being used by projects like Elastic Search and Solr (optionally), Protostuff-rpc supports it, although it is not as widely as say Thrift or protobuf.

编辑(2011 年 12 月)——现在还有 PHP、Ruby 和 Python 的 libsmile 绑定,因此语言支持正在改进.此外还有数据大小的测量;虽然对于单记录数据替代方案(Avro、protobuf)更紧凑,但对于数据流,由于键和字符串值反向引用选项,Smile 通常更紧凑.

EDIT (Dec 2011) -- there are now also libsmile bindings for PHP, Ruby and Python, so language support is improving. In addition there are measurements on data size; and although for single-record data alternatives (Avro, protobuf) are more compact, for data streams Smile is often more compact due to key and String value back reference option.

这篇关于json的紧凑二进制表示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆