1

I was looking at proto3 documentation and it is not clear to me if I can create an rule for my use case. The equivalent in c++ will be to have the following declaration:

 using Variant = std::variant<bool, int32_t, uint32_t, int64_t, uint64_t, float, double>;

 using Data = std::vector<std::vector<Variant>>;

Is it possible to describe "Data" using protobuf? From my understanding think it should probably be something like "repeated repeated Any".

IzonFreak
  • 409
  • 1
  • 5
  • 15

1 Answers1

1

You cannot have a repeated repeated Any. Try the following code:

message SubData {
    repeated google.protobuf.Any element = 1;
}

message Data {
    repeated SubData sub_data = 1;
}
for_stack
  • 21,012
  • 4
  • 35
  • 48
  • Can you kindly take a look in this [question](https://stackoverflow.com/questions/71307445/how-to-access-content-of-repeated-message-data)? I have initiated the approach by following this answer but could not access the elements. – user10634362 Mar 02 '22 at 07:00