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

查看:473
本文介绍了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 基准测试,微笑在此竞争以及其他二进制格式(节俭,avro,protobuf);从大小上看,它并不是最紧凑的(因为它确实保留了字段名),但对于名称重复的数据流则要好得多.

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.

EDIT(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天全站免登陆