> On Nov 15, 2016, at 9:15 AM, Bojan D <dbo...@gmail.com> wrote: > > Newbie question... If I have the following sample "User" JSON data: > > { > firstName: 'Bob' > lastName: 'Smith', > email: 'b...@gmail.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?
You want to use the well-known types “Struct” or “Value”, which are specifically designed to support ad hoc JSON parsing. “Struct” supports parsing any valid JSON object structure, “Value” can parse any valid JSON: message User { string email = 1; string firstName = 2; string lastName = 3; google.protobuf.Struct metadata = 4; } Tim -- 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 protobuf+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.