Re: [protobuf] Failed to parse map

2017-06-08 Thread Qian Zhang
Thanks Adam, I have tried it, it works perfectly!!! Regards, Qian Zhang On Thu, Jun 8, 2017 at 2:03 AM, Adam Cozzette wrote: > Oops, sorry about that. Somehow I had gotten mixed up and thought this was > our Google-internal mailing list, so that would explain why the

Re: [protobuf] Failed to parse map

2017-06-07 Thread 'Adam Cozzette' via Protocol Buffers
Oops, sorry about that. Somehow I had gotten mixed up and thought this was our Google-internal mailing list, so that would explain why the link was not accessible. Here is the example code I was trying to link to: The proto file: syntax = "proto2"; package acozzette; message MapMessage {

Re: [protobuf] Failed to parse map

2017-06-07 Thread 'Adam Cozzette' via Protocol Buffers
Hmm, that's strange. If that's not working, you can always just look at the file in a Piper client, though. On Tue, Jun 6, 2017 at 8:03 PM, Qian Zhang wrote: > It seems the URL http://google3/experimental/users/acozzette/ > map_reflection_test.cc?rcl=158157727 is not

Re: [protobuf] Failed to parse map

2017-06-06 Thread Qian Zhang
It seems the URL http://google3/experimental/users/acozzette/map_reflection_test.cc?rcl=158157727 is not working, I can not access it :-( Regards, Qian Zhang On Wed, Jun 7, 2017 at 1:32 AM, Adam Cozzette wrote: > Here's an example of how to do it: http://google3/ >

Re: [protobuf] Failed to parse map

2017-06-06 Thread 'Adam Cozzette' via Protocol Buffers
Here's an example of how to do it: http://google3/experimental/users/acozzette/map_reflection_test.cc?rcl=158157727 It's a bit clunky because you just have to reflect on the map field like you would a repeated field, but it works. On Mon, Jun 5, 2017 at 6:08 PM, Qian Zhang

Re: [protobuf] Failed to parse map

2017-06-05 Thread Qian Zhang
Thanks Adam. Can you please let me know which API I can use to do reflection on a map? Regards, Qian Zhang On Mon, Jun 5, 2017 at 11:42 PM, Adam Cozzette wrote: > Doing reflection on a map is a little bit tricky, but the way to do it is > to treat it as a repeated field

Re: [protobuf] Failed to parse map

2017-06-05 Thread 'Adam Cozzette' via Protocol Buffers
Doing reflection on a map is a little bit tricky, but the way to do it is to treat it as a repeated field since that is how it is actually represented on the wire. A map is a stored as a repeated message field, where in each message the key is field 1 and the value is field 2. On Mon, Jun 5, 2017

Re: [protobuf] Failed to parse map

2017-06-05 Thread Qian Zhang
Hi Adam, We are using picojson to parse the JSON file. After more debugging, I think I have found the root cause: In the code here , we are trying to find a field by

Re: [protobuf] Failed to parse map

2017-06-02 Thread 'Adam Cozzette' via Protocol Buffers
It looks to me like your JSON syntax is right. Could you post the C++ code you are using to parse the JSON file? On Fri, Jun 2, 2017 at 1:16 AM, Qian Zhang wrote: > Hi, > > I have a C++ project in which there is a .proto file, and in that file, > there is protobuf message