According to the proto3 JSON spec, lowerCamelCase names will be used
instead of the original proto field name. So the JSON serializer will use
"useId" instead of "user_id" and "userId" is also what the parser expects.
We will add an option to support "user_id" names though.

On Thu, Sep 24, 2015 at 1:52 AM, sam sun <suns...@gmail.com> wrote:

> I have a proto:
>   message Person {
>      string user_id;
>   }
> and write a json:
>    { "user_id" : "123" }
>
> I try to use JsonFormat.Parser to parse the json, but it failed. I found 
> JsonFormat
> will call fieldNameToCamelName. I'm really confused. If the parser in
> java required camel fieldname, the parser in c++ required user_id or userId
> ?
> I think it's better to let the field name reserved the same as defined in
> proto or supply a optional to set whether convert the field name to camel.
>
> --
> 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 protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at http://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 protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to