I'm not familiar with the .desc
extension but I'm guessing from the context that it is a file containing a protobuf FileDescriptorProto
, defined in google/protobuf/descriptor.proto
.
To do what you want, you will most likely need to use the Protobuf C++ or Java library, each of which defines a class DynamicMessage
which has the ability to emulate arbitrary message types based on descriptors. You can then combine this with any Protobuf-JSON library that is based on the standard Protobuf reflection interfaces. (You can also write your own JSON converter pretty easily; use the TextFormat
class (found in both the C++ and Java Protobuf libs) as a template.)
My understanding is that protobuf-c does not currently contain an equivalent to DynamicMessage
.