Thanks a lot .. I am planning to try 1 and 2..  Messages would come from
different source, some are binary data . So, option 3 will mess up.  Thanks
a lot Nadav

On Mon, 9 Sep 2019 at 10:58, Nadav Samet <[email protected]> wrote:

> I am not fully aware of what changes you can make in your system. You
> might be able to do any of the following:
> 1. change the sending side to use base64 .
> 2. on the receiving side, convert hex to base64 before calling the Google
> parser (this is what you suggested above).
> 3. change the type of the field in the protobuf from bytes to string, and
> convert the hex string to bytes in your own code after the json is parsed.
> This is a change in the binary representation, so if you have existing
> messages you persisted somewhere using the old format, that would no't work.
>
> -Nadav
>
>
> On Sun, Sep 8, 2019 at 10:18 PM Arun <[email protected]> wrote:
>
>> Thanks Nadav..! Perfect.!  This is what causing the problem.   In Json,
>> value will be always passed as hexString like 12340000.  Do I need to
>> change the json value to base64 encoded string as intermediate layer and
>> then use the Google parser?  What will be your suggestion. ?
>>
>> Thanks Nadav
>>
>> On Fri, 6 Sep 2019 at 20:48, Nadav Samet <[email protected]> wrote:
>>
>>> Note that the JSON protobuf format represents bytes as base64 string:
>>> https://developers.google.com/protocol-buffers/docs/proto3#json
>>> I think you assume the bytes are going to be represented as an hexstring
>>> in the json, given your earlier question
>>> <https://groups.google.com/forum/#!topic/protobuf/qugKZT26aLg>.
>>>
>>> -Nadav
>>>
>>> On Thursday, September 5, 2019 at 11:45:15 PM UTC-7, arun kumar wrote:
>>>>
>>>> I have JSON data like below,
>>>>
>>>> {
>>>>   "clientIdentifier": {
>>>>     "context": "CFID",
>>>>     "value": "12340000"
>>>>   },
>>>>   "desiredSessionTimeout": "30000"
>>>> }
>>>>
>>>> Value 12340000 is the datatype of  " ByteString " as per proto
>>>>
>>>> When I am trying to parse using JSON parser
>>>>
>>>> Google.Protobuf.JsonParser parser = Google.Protobuf.JsonParser.Default;
>>>> IMessage imesg= parser.Parse(json, MessageDescriptor);
>>>>
>>>> imesg is getting created but the value is being return as 12340000.
>>>> Because of this , serialized data is showing wrong value.  I tried
>>>> JSONParser settings as well. But I couldnt get the desired result..
>>>>
>>>> I got struck at this point. Please help me out
>>>>
>>>> Thanks in Advance,
>>>> Arun
>>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/protobuf/37f435a7-3650-419e-8deb-0478f4f11c69%40googlegroups.com
>>> <https://groups.google.com/d/msgid/protobuf/37f435a7-3650-419e-8deb-0478f4f11c69%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>> --
>> -- Arun
>>
>>
>
> --
> -Nadav
>


-- 
-- Arun

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/CAG5mLyuj95kx3UntyFujLB830CFtbnW%2Bj_tBByCbe_%3DnTLpXwg%40mail.gmail.com.

Reply via email to