No, unfortunately I don't think that is supported. You can set the
json_name field option in your .proto file to specify the field name to be
used for JSON, but you can't specify more than one name for a field.

On Wed, Aug 14, 2019 at 4:00 PM Ma N <[email protected]> wrote:

> let's say 2 jsons have different keys but map to the same key in the
> buffer, for example:
>
> {
>  keyA:1,
>  keyB:5
> }
>
> should map to a buffer containing:
>
> { quantity: 1, cost: 5 }
>
> and:
>
> {
>  keyC:5,
>  keyD:10
> }
>
> should map to a buffer containing:
>
> { quantity: 5, cost: 10 }
>
> as you can see both "KeyA", "KeyC" map to quantity and "KeyB", "KeyD" to
> "cost".
>
> How can we do that with protobuf?
>
> Thank you!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/protobuf/67303340-2961-499e-af60-e9c3cef371fb%40googlegroups.com
> <https://groups.google.com/d/msgid/protobuf/67303340-2961-499e-af60-e9c3cef371fb%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/CADqAXr5PqsnwbBw1yvgi3pyfqEMrsB_NFNxT0Ew1kxiB%3DgS2QQ%40mail.gmail.com.

Reply via email to