1
我有以下的protobuf定義谷歌protobuf的如何添加子兒
message test {
repeated string fruit = 1 [(order_is_significant) = true]
}
我要添加蘋果,梨protbuf和輸出應該看起來像
"test": [
{
"fruit": [
"apple",
"pear"
]
"rank": 1
}
我試圖添加使用test.addFruit( 「蘋果」)和test.addFruit( 「梨」)方法,但輸出看起來像
test {
fruit: "apple"
fruit: "pear"
rank: 1
}
任何想法?