Hi,

I see the file json_util.h 
<https://github.com/google/protobuf/blob/master/src/google/protobuf/util/json_util.h>
 has 
a utility function ("JsonStringToMessage()") which can be used to convert a 
JSON string to a protobuf message, and I'd like to know if the JSON string 
contains an non-existent enum value for an optional enum field (see below 
as an example), how will the utility function handle it?

// JSON string
{
 "type": "XXX"
}

// Protobuf message definition
message Foo {
  enum Type {
    UNKNOWN = 0;
    CREATE = 1;
    DELETE = 2;

  }

  optional Type type = 1;
} 


Will the utility function error out in this case since it can not find enum 
value "XXX"? Or it will automatically set the field "type" to its default 
value "UNKNOWN"?


Thanks,
Qian Zhang

-- 
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 https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to