How to convert FlatBuffer message from binary to human readable text format with Python?

Viewed 894

I am writing a tool to dump our dedicated ML model from flatbuffers binary into human readable text format, is there any helper like text_format for protobuf?

1 Answers

There's currently no way to do that directly in Python, you'll need to invoke the command-line flatc tool to do so, e.g. flatc --json myschema.fbs mybinary.bin results in mybinary.json.

If necessary, it would be possible to compile the C++ json generator (and parser) into something that can be called from Python (through C), but that requires knowledge on how to create such extension libraries for Python.

Related