On Mon, Aug 20, 2018 at 10:02 PM Siddharth <[email protected]>
wrote:

> Hi feng,
>
> Can we convert JSON object into Google.protobuf.Any format? If yes, can
> you provide an example. Thanks for the help.
>
Check out the Any unittest examples:
https://github.com/google/protobuf/blob/master/java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java#L835


>
> Thanks,
> Sid
>
> On Tue, Aug 21, 2018, 10:27 AM 'Feng Xiao' via Protocol Buffers <
> [email protected]> wrote:
>
>>
>>
>> On Mon, Aug 20, 2018 at 9:24 PM akshay patil <[email protected]> wrote:
>>
>>> I have protoc installed which I can run via command line. I did install
>>> protobuf using conda and when I check in my site-packages in my python
>>> environment under ` site-packages/google/protobuf ` I do not see any
>>> *.proto files
>>>
>> They are not in your python site-packages, but should be installed along
>> side with the protoc binary. Check where your protoc is and look around to
>> see if the protos are install there.
>>
>> Try compile the following proto and see if protoc can find the right
>> imports:
>>
>> syntax = "proto3";import "google/protobuf/any.proto";
>>
>> message Test {
>>    google.protobuf.Any var1 = 1;}
>>
>> If you are unsure whether your proto definition is valid (your original
>> one has a invalid import path and incomplete type name for Any), try it
>> here:
>> https://unpkg.com/[email protected]/index.html
>>
>> If you can get it working it on this site, you should be able to get it
>> working locally as well.
>>
>>
>>>
>>> On Monday, August 20, 2018 at 11:09:10 PM UTC-5, Feng Xiao wrote:
>>>>
>>>> Have you install protocol compiler, i.e., protoc? These protos should
>>>> be installed along with the protoc binary if you get it from our release
>>>> page.
>>>>
>>>> On Mon, Aug 20, 2018 at 8:13 PM akshay patil <[email protected]> wrote:
>>>>
>>>>>  I am trying to define my own messages representing python classes
>>>>> that I want to serialize. However, I need to import any.proto or
>>>>> timestamp.proto in my .proto files to represent certain messages
>>>>>
>>>>> syntax = "proto3";import "/google/protobuf/any.proto";
>>>>>
>>>>> message Test {
>>>>>    Any var1 = 1;}
>>>>>
>>>>>
>>>>> However, seems like the protobuf installation does not come with any
>>>>> .proto files. I am using python 3.5 and have protobuf 3.5.2 installed. I
>>>>> tried to look under google/protobuf/ but just found the compiled
>>>>> files like ant_pb2.py and timestamp_pb2.py. I am following docs here
>>>>> to import any.proto -
>>>>> https://developers.google.com/protocol-buffers/docs/proto3#any
>>>>>
>>>>> --
>>>>> 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 post to this group, send email to [email protected].
>>>>> Visit this group at https://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 [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at https://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 [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at https://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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to