converting protobuf to json and json to protobuf at runtime where proto struct is a string

Viewed 317

I'm developing a small C++ library to convert protobuf to Json and vice versa. I am using Protobuf C++ API (https://developers.google.com/protocol-buffers/docs/reference/cpp). The library, for example, should accept a protobuf message as a string, protobuf binary data, and return a Json string. The Protobuf c++ API makes this easy to implement if the protobuf structure is in the .proto file, but mine is a string. Writing the proto string to a temporary .proto file so that I can read it later and delete it doesn't seem like an elegant solution to me. Please help me find a better solution than this.

Thanks in advance

0 Answers
Related