You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2022/12/23 05:25:12 UTC

[GitHub] [incubator-brpc] wasphin commented on issue #2054: Pb2JsonOptions的注释与实际相反

wasphin commented on issue #2054:
URL: https://github.com/apache/incubator-brpc/issues/2054#issuecomment-1363630416

   > ```
   > 1、single_repeated_to_array字段的注释中,default是false。
   > 2、但是实际使用时发现,默认是开启的。例如
   > "my_field": ["value1"], my_field是一个repeated字段,没有设置single_repeated_to_array的情况下,仍然解析为array
   > ```
   
   参考这个示例:
   https://github.com/apache/incubator-brpc/blob/master/docs/cn/json2pb.md#repeated-field
   
   效果是当开启`single_repeated_to_array` 时,序列化为:
   ```json
   ["value1"]
   ```
   而不是
   ```json
   {
      "my_field": ["value1"]
   }
   ```
   
   假设使用的 proto 是:
   ```proto
   message foo {
       repeated string my_field = 1;
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org