How to define an array in protobuf?

Viewed 178

my server need an array input, like

[
  {
    "name":"ada",
    "age":"20"
  }
]

and I have no idea to define the protobuf, thank you for your consideration

1 Answers

Arrays aren't a concept in protobuf; there is repeated, but how that is interpreted is implementation specific; it could be an array, but it doesn't need to be; as for the .proto:

syntax = "proto3";
message SomeWrapper {
    repeated SomeInner items = 1;
}
message SomeInner {
    string name = 1;
    int32 age = 2;
}
Related