• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

shafreeck/pb2json: Decode protobuf to json format

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

shafreeck/pb2json

开源软件地址:

https://github.com/shafreeck/pb2json

开源编程语言:

C++ 87.3%

开源软件介绍:

1. Introducton:

Decode protobuf to json format

Build Status

It depends on jansson(https://github.com/akheron/jansson) to pack json

Support all type of protobuf Message (example: see test/person.proto) and binary bytes(jansson does not support binary bytes) will be translated to hex sequence

2. Install

This library depends on jansson(http://www.digip.org/jansson/)

We assumed you have installed protobuf

1) install jansson

wget "http://www.digip.org/jansson/releases/jansson-2.1.tar.gz "
tar -zxvf jansson-2.1.tar.gz
cd jansson-2.1
./configure
make
sudo make install

2)install pb2json (is simple)

make
sudo make install

3. Test & example

cd $src/test
run make to generate object files
./runtest to see the result

4. Usage

You can refer to $src/test/test_json.cpp

It is pretty simple to use ,and we just have one API:

char *pb2json(Message *msg,const char *buf, int len);

return json string if sucess ,NULL if failed,it should be freed by caller
msg : instance of class generated by protoc
buf : binary content of protobuf
len : length of buf

There is another variance:

char *pb2json(Message &msg)




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
YDulanjani/ConvertExcelToJSON发布时间:2022-07-09
下一篇:
nutzam/nutz: Nutz -- Web Framework(Mvc/Ioc/Aop/Dao/Json) for ALL Java developer发布时间:2022-07-09
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap