C++ Protobuf to/from JSON conversion [closed] C++ Protobuf to/from JSON conversion [closed] json json

C++ Protobuf to/from JSON conversion [closed]


This one is better IMO: https://github.com/shramov/json2pb

it does conversion in both directions and handles extensions


pbjson is another one, which built on rapidjson, maybe faster.


I've made a bootstrap implementation of a JSON parser for protobuf generated types, using the its reflection mechanism, and adapting the parse I've made previously for CORBA IDL generated types.

You can find it at http://corbasim.googlecode.com/svn/trunk/protobuf2json_exported.zip

By this way for each protobuf defined message, you will be able to parse its instances by doing:

Foo foo;const std::string json_foo = "{\"text\": \"Hello world\"}";protobuf2json::json::parse(foo, json_foo);

It's just an initial implementation, and it just support string fields, but it's easy to implement all kind of fields.