Skip to content

gityf/pb2jsoncpp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

1. Introducton:

Decode protobuf to json format. Porting from pb2json (https://github.com/renenglish/pb2json). Use jsoncpp to replace jansson. 

Support all type of protobuf Message (example: see test/person.proto) except binary bytes(json is text not binary)

2. Install

This library depends on jsoncpp(http://jsoncpp.sourceforge.net) 

* We assumed you have installed protobuf

1) install jsoncpp
  Download jsoncpp from http://jsoncpp.sourceforge.net
  Follow the steps in README.TXT to install it.
 
2) install boost
  sudo apt-get install libboost-all-dev

 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

 msg : instance of class generated by protoc
 buf : binary content of protobuf
 len : length of buf

About

Decode protobuf to json format. Porting from pb2json (https://github.com/renenglish/pb2json). Use jsoncpp to replace jansson.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 82.5%
  • Makefile 10.6%
  • Shell 3.5%
  • Protocol Buffer 3.4%