0

I received a string that presents a protobuff as: "CoYBChVOZXRoZXJsYW5kcyg2OTBWIEwtTCkQCBoBMCAAKAEwATgCQ", I can convert it to read able string

as:

a{
  b{
    c1{
      value: 2023
       }
    c2{
      value: 1
      }
    }
  }

but I need it in ajson\/dictionary format. how can I convert it?

I've tried using protobuf library:

from google.protobuf.json_format import MessageToDict

protobuf_string = "CoYBChVOZXRoZXJsYW5kcyg2OTBWIEwtTCkQCBoBMCAAKAEwATgCQ"

dict_obj = MessageToDict(protobuf_string)

but the MessageToDict needs to get a proto object,

if someone has an idea/ how to convert the string to protobuff object(with out compiling)

thanks!

esh
  • 1
  • 1
  • the question is similar to this : https://stackoverflow.com/questions/68056043/convert-serialized-protobuf-output-to-python-dictionary but the difference is that i have it also as a string. – esh Feb 08 '23 at 14:40

0 Answers0