Nested Value() and adding data to it

21 views
Skip to first unread message

Calicoder

unread,
Jan 13, 2022, 3:11:56 PMJan 13
to Protocol Buffers
Howdy, been wondering if this is possible as looking at the official Google Protobuf docs is not showing if it is. I did find the Value() constructor part and I know I can use the various add_ methods to populate it but is this possible to make a detailed value_map with a key string and have another value_map inside that with a key value pair? So basically a nested Value map?

Appreciate the help, thanks!

Adam Cozzette

unread,
Jan 14, 2022, 2:23:57 PMJan 14
to Calicoder, Protocol Buffers
There is no built-in support for nested maps, so for example map<string, map<string, Value>> is not a valid field type. However you can accomplish something roughly equivalent by using something like map<string, MyMap> where MyMap is just a message containing a map.

On Thu, Jan 13, 2022 at 12:11 PM Calicoder <draz...@gmail.com> wrote:
Howdy, been wondering if this is possible as looking at the official Google Protobuf docs is not showing if it is. I did find the Value() constructor part and I know I can use the various add_ methods to populate it but is this possible to make a detailed value_map with a key string and have another value_map inside that with a key value pair? So basically a nested Value map?

Appreciate the help, 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 protobuf+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/c20d3a31-e46f-42a3-aa86-1f17a44e077dn%40googlegroups.com.

Calicoder

unread,
Jan 15, 2022, 12:21:46 PMJan 15
to Protocol Buffers
Appreciate the reply, thank you!
Reply all
Reply to author
Forward
0 new messages