3 ms·
Slightly off topic, but is anyone aware of a compile free method to convert protobuf messages to json representation based on a provided .proto file (and the ot
by this_was_posted 3mo ago
Slightly off topic, but is anyone aware of a compile free method to convert protobuf messages to json representation based on a provided .proto file (and the other way around)? All protobuf implementations seem to require a compilation step, which makes it hard to support en-/decoding untrusted content using user provided schemas
- sudorandom 3mo agoThe buf CLI can do this. Here's how it looks to convert from encoded protobuf to json (protojson). buf convert schema.proto \ --type YourMessageName \ --from payload.binpb \ --to output.json And just invert the arguments to convert back. buf convert schema.proto \ --type YourMessageName \ --from data.json \ --to encoded.binpb
- fisian 3mo agoThere is the --encode (and --decode) options for the `protoc` executable, e.g. `cat myobject.json | protoc --encode MyObject protofile.proto > myobject.bin`
- physicalecon 3mo ago[dead]