protocol-buffers

Convert JSON object to protobuf IStruct

寵の児 提交于 2020-05-28 11:53:27
问题 I am using the Dialogflow API for Nodejs. This API is apparently implemented by Google via protocol buffers, though it presents a simple JavaScript/JSON based interface that I have used successfully for simple queries. In order to request Dialogflow send me response data for a particular platform, I apparently need to encode a simple JSON object into protobuf format. The linked source gives an example that makes use of a "structjson util" that can presumably be used to do the necessary

Convert JSON object to protobuf IStruct

房东的猫 提交于 2020-05-28 11:52:30
问题 I am using the Dialogflow API for Nodejs. This API is apparently implemented by Google via protocol buffers, though it presents a simple JavaScript/JSON based interface that I have used successfully for simple queries. In order to request Dialogflow send me response data for a particular platform, I apparently need to encode a simple JSON object into protobuf format. The linked source gives an example that makes use of a "structjson util" that can presumably be used to do the necessary

Convert JSON object to protobuf IStruct

柔情痞子 提交于 2020-05-28 11:52:00
问题 I am using the Dialogflow API for Nodejs. This API is apparently implemented by Google via protocol buffers, though it presents a simple JavaScript/JSON based interface that I have used successfully for simple queries. In order to request Dialogflow send me response data for a particular platform, I apparently need to encode a simple JSON object into protobuf format. The linked source gives an example that makes use of a "structjson util" that can presumably be used to do the necessary

(Node.js) --grpc_out: protoc-gen-grpc: %1 is not a valid Win32 application

帅比萌擦擦* 提交于 2020-05-16 01:42:17
问题 I want to compile my .proto file into stubs, but when entering the command: `protoc -I=. ./protos/dummy.proto --js_out=import_style=commonjs,binary:./server --grpc_out=./server --plugin=protoc-gen-grpc=which grpc_tools_node_protoc_plugin I got the following error : --grpc_out: protoc-gen-grpc: %1 is not a valid Win32 application. Thigs I have installed : Windows 10 npm install -g grpc-tools npm install google-protobuf protoc NOTE: I noticed there are a few similar questions already, but I

How do I compare the contents of two Google Protocol Buffer messages for equality?

谁说我不能喝 提交于 2020-05-15 18:40:31
问题 I can't seem to find a comparison method in the API. So I have these two messages, and they have a lot of different values that sometimes drill down to more values (for example, I have a Message that has a string, an int, and a custom_snapshot, where custom_snapshot is comprised of an int, a string, and so on). I want to see if these two messages are the same. I don't want to compare each value one by one, since that will take a while, so I was wondering if there was a quick way to do this in

goog is not defined error while trying to use Protocol Buffers - Google's data interchange format

青春壹個敷衍的年華 提交于 2020-05-15 10:18:09
问题 I am trying to use Protocol Buffers - Google's data interchange format referring https://github.com/google/protobuf/tree/master/js I tried to follow documentation i am able to get the setup of Protocol Compiler and able to do protoc --js_out=library=myproto_libs,binary:. messages.proto but when i do npm install google-protobuf i am getting npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/google- npm ERR! 404 npm ERR! 404 'google-protobuf' is not in the npm registry.

Python protobuf “from google.protobuf.pyext import _message” - “ImportError: DLL load failed: The specified procedure could not be found”

不想你离开。 提交于 2020-05-13 03:58:59
问题 I'm trying to get a simple Python script up to convert protobuf files into json files (required format for what I'm doing at work). I've seen some recommendations to upgrade to Python 3.6.1 (I'm at 3.6.0), up/downgrade google.protobuf. Neither solution helped. def convert_to_json(directory: str): os.chdir(jsonPath) for (root, dirs, files) in os.walk(os.getcwd()): for file_ in files: if os.path.dirname(file_) != root and file_.endswith(".pb"): json_file: str = MessageToJson(file_) file_name =

Python protobuf “from google.protobuf.pyext import _message” - “ImportError: DLL load failed: The specified procedure could not be found”

佐手、 提交于 2020-05-13 03:58:10
问题 I'm trying to get a simple Python script up to convert protobuf files into json files (required format for what I'm doing at work). I've seen some recommendations to upgrade to Python 3.6.1 (I'm at 3.6.0), up/downgrade google.protobuf. Neither solution helped. def convert_to_json(directory: str): os.chdir(jsonPath) for (root, dirs, files) in os.walk(os.getcwd()): for file_ in files: if os.path.dirname(file_) != root and file_.endswith(".pb"): json_file: str = MessageToJson(file_) file_name =

Protocol message tag had invalid wire type

只愿长相守 提交于 2020-05-12 07:08:07
问题 my application sends data through protobuf from a server to a client. When I am deserializing the sent payload on the client side eclipse throws a expection of the follogwing type: Exception in thread "main" com.google.protobuf.InvalidProtocolBufferException: Protocol message tag had invalid wire type. The expection happens when I call "parseFrom()". I know that in most cases the error lies in a protobuf file with the wrong syntax. Therefore I hope that it is enough to post the protobuf

Protobuf error:Protocol message tag had invalid wire type

喜夏-厌秋 提交于 2020-05-10 08:56:56
问题 I am having the following error when trying to read the message in java Exception in thread "main" com.google.protobuf.InvalidProtocolBufferException: Protocol message tag had invalid wire type. at com.google.protobuf.InvalidProtocolBufferException.invalidWireType(InvalidProtocolBufferException.java:78) at com.google.protobuf.UnknownFieldSet$Builder.mergeFieldFrom(UnknownFieldSet.java:498) at com.google.protobuf.GeneratedMessage$Builder.parseUnknownField(GeneratedMessage.java:438)