0

How to serialize JSON to binary Protocol Buffers (Protobuf) serialization on command line? Assuming the JSON follows Protobuf 3 JSON Mapping)

Question How to encode protocol buffer string to binary using protoc has an answer for serializing to Protobuf binary from Protobuf Text Format Language with protoc --decode but if I have understood right, protoc doesn't support JSON. With that, converting from JSON to Protobuf Text Format should answer the need.

Touko
  • 11,359
  • 16
  • 75
  • 105
  • 1
    It isn't supported by protoc. However, if you are willing to write some python (or whatever language) this is feasible. Let me know the language you would prefer and I can post an answer. – Clément Jean Feb 03 '23 at 03:19
  • Thanks for the info and the offer! I roughly have that already for my current need, though it would be nice to find a way with minimal tooling. – Touko Feb 03 '23 at 15:56
  • 1
    I would say that a binary containing all dependencies would be similar to protoc (you can maybe even wrap protoc commands). You can do that with Go for example. – Clément Jean Feb 04 '23 at 14:53

0 Answers0