热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

谷歌协议缓冲区vsjsonvsXML-googleprotocolbuffersvsjsonvsXML

Iwouldliketoknowthemerits&de-meritsof我想知道它的优点和缺点GoogleProtocolBuffers谷歌协议缓冲区

I would like to know the merits & de-merits of

我想知道它的优点和缺点

  • Google Protocol Buffers
  • 谷歌协议缓冲区
  • JSON
  • JSON
  • XML
  • XML

I want to implement one common framework for two application, one in Perl and second in Java. So, would like to create common service which can be used by both technology i.e. Perl & Java.

我想为两个应用程序实现一个通用框架,一个用Perl,另一个用Java。因此,我们希望创建可以被Perl和Java这两种技术使用的公共服务。

Both are web-applications.

都是网络应用程序。

Please share me your valuable thoughts & suggestion on this. I have seen many links on google but all have mixed opinions.

请分享你的宝贵意见和建议。我在谷歌上看到过很多链接,但都有不同的观点。

1 个解决方案

#1


240  

Json

Json

  • human readable/editable
  • 人类可读/可编辑
  • can be parsed without knowing schema in advance
  • 可以在不事先知道模式的情况下进行解析吗
  • excellent browser support
  • 优秀的浏览器支持
  • less verbose than XML
  • 那么冗长的XML

XML

XML

  • human readable/editable
  • 人类可读/可编辑
  • can be parsed without knowing schema in advance
  • 可以在不事先知道模式的情况下进行解析吗
  • standard for SOAP etc
  • SOAP标准等
  • good tooling support (xsd, xslt, sax, dom, etc)
  • 良好的工具支持(xsd、xslt、sax、dom等)
  • pretty verbose
  • 很详细的

Protobuf

Protobuf

  • very dense data (small output)
  • 非常密集的数据(小的输出)
  • hard to robustly decode without knowing the schema (data format is internally ambiguous, and needs schema to clarify)
  • 不了解模式就很难进行健壮的解码(数据格式在内部是不明确的,需要模式来澄清)
  • very fast processing
  • 非常快的处理
  • not intended for human eyes (dense binary)
  • 不适合人眼(密集的双星)

All have good support on most platforms.

它们在大多数平台上都有很好的支持。

Personally, I rarely use XML these days. If the consumer is a browser or a public API I tend to use json. For internal APIs I tend to use protobuf for performance. Offering both on public API (either via headers, or separate endpoints) works well too.

就我个人而言,我现在很少使用XML。如果消费者是浏览器或公共API,我倾向于使用json。对于内部api,我倾向于使用protobuf来提高性能。提供公共API(通过头文件或单独的端点)也可以很好地工作。


推荐阅读
author-avatar
李-诗-妍_519
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有