Generic Pub / Sub; To and from JSON
I am interested in subscribing to a set of topics, receiving messages and sending messages to topics. I have a generic subscription as void cb_generic(const std::string& _msg)
. The content of the string is protobuf binary message which I want to convert to JSON. Any suggestions or examples on how to accomplish this task? The steps I see are:
- Convert std::string to protobuf object
- Convert protobuf object to json.
Thanks