Wondering if Flatbuffers/Flexbuffers would be a better fit for your requirements? https://google.github.io/flatbuffers/flexbuffers.html
On Wed, May 6, 2020 at 1:18 PM 'Adam Cozzette' via Protocol Buffers < [email protected]> wrote: > Protobuf uses its own wire format > <https://developers.google.com/protocol-buffers/docs/encoding>, and > unfortunately there is no way to make it conform to another binary format > such as C struct layouts. > > On Wed, May 6, 2020 at 11:44 AM leerho <[email protected]> wrote: > >> I am new to proto buffers but it might be just what I need. However, I >> have a couple of special requirements that I can't quite discern from the >> documentation: >> >> - In my case the binary field layout is already defined. Think of it >> as a C struct, with packed primitives: bytes, ints, longs, double, arrays, >> etc. Can I use Protobuf to describe that layout and read and write it as >> well? To maintain compatibility of existing systems, I cannot have any >> compression or mangling of the struct layout. >> - Is it possible to have dynamic nested messages? For example, based >> on a decoded value of an outer message, the nested message could be of >> different types with completely different structures. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Protocol Buffers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/protobuf/37423e34-ef61-4891-a432-40678e0a5c5a%40googlegroups.com >> <https://groups.google.com/d/msgid/protobuf/37423e34-ef61-4891-a432-40678e0a5c5a%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/protobuf/CADqAXr7KehoG1N61%2BHR5M144QH9fm3j-FTyJYK_jhEX1iTO6cg%40mail.gmail.com > <https://groups.google.com/d/msgid/protobuf/CADqAXr7KehoG1N61%2BHR5M144QH9fm3j-FTyJYK_jhEX1iTO6cg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/CAD7-yft8O9ukpmtyHK3_4mcMvZeO_%2Bqa0w_3V%2BQhJLLuDnyQ_A%40mail.gmail.com.
