I am facing problem in getting Message with extension from JSON string  
{"xyz": [1234,2345,3456],"extensions":{"bar": [1,11,111]}} which is 
generated from Foo.
 
message Foo {
 repeated int32 xyz = 11;
 extensions 100 to 199; 
}
 
extend Foo {
 repeated int32 bar = 123;
}
 
The word "extensions" in the JSON stirng is just added to differentiate 
with other normal fileds.
 
Now, when I try to deserialize protobuf, i.e protobuf Message from JSON 
string. Facing difficulty here.
 
fd is NULL, when FindExtensionByName or FindKnownExtensionByName is called .
 
Foo foo;
Message *x = &foo; 
const FiledDescriptor *fd;
 
fd = x->GetDescriptor()->FindExtensionByName("bar")    or 

fd = x->GetReflection()->FindKnownExtensionByName("bar");
 
 Could you point out any error in steps which I am following or Is there 
any other better approach?
 
 
Thanks,
Channakeshava 
 

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to