rpc服务需要接收一个list, 请问该怎么定义输入的protobuf
需要发送的请求参数格式如下:
[
{
"name": "ada",
"age":"12"
}
]
已经尝试过的定义有:
message DocMsg
{
string name = 1;
string age = 2;
}
message HelloRequest
{
repeated DocMsg doc = 1;
}
和
message HelloRequest {
// 嵌套消息定义
message Docmsg {
string name = 1;
string age = 2;
}
// 引用嵌套的消息定义
repeated Docmsg doc = 1;
}
实际接收的请求参数都是
{
"doc":[
{"name":xxx, "age":xxx},
...
]
}
有没有做过的老哥指点一下,
二维数组应该是不支持的 参考:stackoverflow.com/questions/209686...
用json序列化list为byte,接收端在反序列化一下,可以吗。