Hi Feng,
Thank you!
On Tuesday, April 26, 2016 at 12:04:07 AM UTC+2, Feng Xiao wrote:
>
> You can use the json_name field option to specify the name you want to use
> in JSON. For example:
> message Foo {
> string id = 1 [json_name = "@id"];
> }
>
> The JSON format will then be:
> {
> "@id": "..some value..."
> }
>
> On Mon, Apr 25, 2016 at 5:54 AM, 'David Koch' via Protocol Buffers <
> [email protected] <javascript:>> wrote:
>
>> Hello,
>>
>> Using the JSON printing/parsing utilities in proto3 - is it possible to
>> override the default JSON field names generated? If so, how can this be
>> achieved?
>>
>> I use the standard way to instantiate the printer and parser for now:
>> private static JsonFormat.TypeRegistry registry =
>> JsonFormat.TypeRegistry.newBuilder()
>> .add(MyClass.getDescriptor()).build();
>> private static JsonFormat.Printer printer =
>> JsonFormat.printer().usingTypeRegistry(registry);
>> private static JsonFormat.Parser parser =
>> JsonFormat.parser().usingTypeRegistry(registry);
>>
>> Thanks,
>>
>> Regards,
>>
>> David
>>
>>
>> --
>> 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] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/protobuf.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.