I think what you're looking for is `google.protobuf.Struct details`; Struct is the type which allows any JS object to parse into it and acts like a `map<string, SomeJSONValueType>` (including recursively a struct inside if its another JS object in there).
On Wed, Nov 6, 2024 at 7:52 AM 'Ayush Shah' via Protocol Buffers < [email protected]> wrote: > Newbie question... If I have the following sample "User" JSON data: > > { > firstName: 'Bob' > lastName: 'Smith', > email: '[email protected] <https://groups.google.com/>', > metadata: { > // a plain JS object that > // - will always exist and be at least an empty {} object > // - could potentially contain any number of properties and values, > depending on specific "user" > } > } > > How do I represent the metadata property within proto definition? I've > tried > > message User { > message Metadata {} > > string email = 1; > string firstName = 2; > string lastName = 3; > Metadata metadata = 4; > } > > or using `Any` > > message User { > string email = 1; > string firstName = 2; > string lastName = 3; > google.protobuf.Any details = 4; > } > > > but without success. Working within Node.js if relevant. Any help is much > appreciated. Thanks! > > -- > 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 visit > https://groups.google.com/d/msgid/protobuf/276ff12e-a207-495a-9c92-adcc41b85b4an%40googlegroups.com > <https://groups.google.com/d/msgid/protobuf/276ff12e-a207-495a-9c92-adcc41b85b4an%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 visit https://groups.google.com/d/msgid/protobuf/CAKRmVH8UsBOV6cNsOGmuAyv0nUJpJngKGo8xGP3mMDaOZ4hn%3Dw%40mail.gmail.com.
