我想知道如何在不必指定键的情况下将数组作为消息体传递。我可以轻松做到:
message TypeResponse {
message Type {
string ID = 1;
string Name = 2;
string Description = 3;
string IsMobile = 4;
string IsTablet = 5;
string IsDesktop = 6;
}
repeated Type types = 1;
}
那会回应:
{
"types": [
{
"ID": 1
...
}
]
}
我想将我的响应构造如下以匹配我的 REST API:
[
{
"ID": 1
...
},
{
"ID": 2
...
}
]